mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Simplify git onAuth calls
This commit is contained in:
4 files changed
+11
-47
No files matched your search
@@ -65,15 +65,6 @@ export class GitPushCommand implements GitSubcommand {
|
||||
}
|
||||
|
||||
const settings = await readGitSettings(this.fs);
|
||||
const currentCredentials = findCredentialsForRepo(remoteUrl, settings.credentials);
|
||||
|
||||
// Prepare authentication if credentials are available
|
||||
const authOptions = currentCredentials ? {
|
||||
onAuth: () => ({
|
||||
username: currentCredentials.username,
|
||||
password: currentCredentials.password,
|
||||
}),
|
||||
} : {};
|
||||
|
||||
try {
|
||||
await this.git.push({
|
||||
@@ -81,7 +72,7 @@ export class GitPushCommand implements GitSubcommand {
|
||||
remote: remote,
|
||||
ref: targetBranch,
|
||||
remoteRef: targetBranch,
|
||||
...authOptions,
|
||||
onAuth: (url) => findCredentialsForRepo(url, settings.credentials),
|
||||
});
|
||||
|
||||
return createSuccessResult(`To ${remoteUrl}\n ${targetBranch} -> ${targetBranch}\n`);
|
||||
|
||||
Reference in new issue
Block a user