Skip to content

Commit bed464f

Browse files
committed
rebase, lint & code fixes
1 parent 0c269b3 commit bed464f

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

Diff for: package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -4578,23 +4578,22 @@
45784578
"gitlens.advanced.messages": {
45794579
"type": "object",
45804580
"default": {
4581-
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false,
4582-
"suppressBlameInvalidIgnoreRevsFileWarning": false,
45834581
"suppressCommitHasNoPreviousCommitWarning": false,
45844582
"suppressCommitNotFoundWarning": false,
45854583
"suppressCreatePullRequestPrompt": false,
45864584
"suppressDebugLoggingWarning": false,
45874585
"suppressFileNotUnderSourceControlWarning": false,
4588-
"suppressGitBranchNotFullyMergedWarning": false,
45894586
"suppressGitDisabledWarning": false,
45904587
"suppressGitMissingWarning": false,
45914588
"suppressGitVersionWarning": false,
4589+
"suppressLineUncommittedWarning": false,
4590+
"suppressNoRepositoryWarning": false,
4591+
"suppressRebaseSwitchToTextWarning": false,
45924592
"suppressIntegrationDisconnectedTooManyFailedRequestsWarning": false,
45934593
"suppressIntegrationRequestFailed500Warning": false,
45944594
"suppressIntegrationRequestTimedOutWarning": false,
4595-
"suppressLineUncommittedWarning": false,
4596-
"suppressNoRepositoryWarning": false,
4597-
"suppressRebaseSwitchToTextWarning": false
4595+
"suppressBlameInvalidIgnoreRevsFileWarning": false,
4596+
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false
45984597
},
45994598
"properties": {
46004599
"suppressCommitHasNoPreviousCommitWarning": {

Diff for: src/env/node/git/git.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,11 @@ function getStdinUniqueKey(): number {
166166
type ExitCodeOnlyGitCommandOptions = GitCommandOptions & { exitCodeOnly: true };
167167
export type PushForceOptions = { withLease: true; ifIncludes?: boolean } | { withLease: false; ifIncludes?: never };
168168

169-
const branchErrorAndReason = [
169+
const branchErrorAndReason: [RegExp, BranchErrorReason][] = [
170170
[GitErrors.noRemoteReference, BranchErrorReason.NoRemoteReference],
171171
[GitErrors.invalidBranchName, BranchErrorReason.InvalidBranchName],
172172
[GitErrors.branchAlreadyExists, BranchErrorReason.BranchAlreadyExists],
173173
[GitErrors.branchNotFullyMerged, BranchErrorReason.BranchNotFullyMerged],
174-
[GitErrors.branchNotYetBorn, BranchErrorReason.BranchNotYetBorn],
175-
[GitErrors.branchFastForwardRejected, BranchErrorReason.BranchFastForwardRejected],
176174
];
177175

178176
export class Git {

Diff for: src/env/node/git/localGitProvider.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1253,25 +1253,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
12531253
}
12541254

12551255
@log()
1256-
createBranch(repoPath: string, name: string, ref: string): Promise<void> {
1256+
async createBranch(repoPath: string, name: string, ref: string): Promise<void> {
12571257
try {
1258-
return void this.git.branch(repoPath, name, ref);
1258+
await this.git.branch(repoPath, name, ref);
12591259
} catch (ex) {
12601260
if (ex instanceof BranchError) {
1261-
throw ex.WithBranch(branch.name);
1261+
throw ex.WithBranch(name);
12621262
}
12631263

12641264
throw ex;
12651265
}
12661266
}
12671267

12681268
@log()
1269-
renameBranch(repoPath: string, oldName: string, newName: string): Promise<void> {
1269+
async renameBranch(repoPath: string, oldName: string, newName: string): Promise<void> {
12701270
try {
1271-
return void this.git.branch(repoPath, '-m', oldName, newName);
1271+
await this.git.branch(repoPath, '-m', oldName, newName);
12721272
} catch (ex) {
12731273
if (ex instanceof BranchError) {
1274-
throw ex.WithBranch(branch.name);
1274+
throw ex.WithBranch(oldName);
12751275
}
12761276

12771277
throw ex;
@@ -1306,7 +1306,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13061306
}
13071307

13081308
const remote = getRemoteNameFromBranchName(branch.upstream.name);
1309-
remoteCommit = await this.git.rev_list(repoPath, `refs/remotes/${remote}/${branch.ref}`, {
1309+
const remoteCommit = await this.git.rev_list(repoPath, `refs/remotes/${remote}/${branch.ref}`, {
13101310
maxResults: 1,
13111311
});
13121312

@@ -1316,8 +1316,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
13161316
await this.git.branch(repoPath, ...args, branch.ref);
13171317
} catch (ex) {
13181318
// If it fails, restore the remote branch
1319-
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, commit);
1320-
await this.git.branch__set_upstream(repoPath, branch, remote, branch);
1319+
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, remoteCommit?.[0] ?? '');
1320+
await this.git.branch__set_upstream(repoPath, branch.name, remote, branch.ref);
13211321
throw ex;
13221322
}
13231323

0 commit comments

Comments
 (0)