Skip to content

Commit 4f145da

Browse files
committed
rebase, lint & code fixes
1 parent c739e18 commit 4f145da

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4593,23 +4593,22 @@
45934593
"gitlens.advanced.messages": {
45944594
"type": "object",
45954595
"default": {
4596-
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false,
4597-
"suppressBlameInvalidIgnoreRevsFileWarning": false,
45984596
"suppressCommitHasNoPreviousCommitWarning": false,
45994597
"suppressCommitNotFoundWarning": false,
46004598
"suppressCreatePullRequestPrompt": false,
46014599
"suppressDebugLoggingWarning": false,
46024600
"suppressFileNotUnderSourceControlWarning": false,
4603-
"suppressGitBranchNotFullyMergedWarning": false,
46044601
"suppressGitDisabledWarning": false,
46054602
"suppressGitMissingWarning": false,
46064603
"suppressGitVersionWarning": false,
4604+
"suppressLineUncommittedWarning": false,
4605+
"suppressNoRepositoryWarning": false,
4606+
"suppressRebaseSwitchToTextWarning": false,
46074607
"suppressIntegrationDisconnectedTooManyFailedRequestsWarning": false,
46084608
"suppressIntegrationRequestFailed500Warning": false,
46094609
"suppressIntegrationRequestTimedOutWarning": false,
4610-
"suppressLineUncommittedWarning": false,
4611-
"suppressNoRepositoryWarning": false,
4612-
"suppressRebaseSwitchToTextWarning": false
4610+
"suppressBlameInvalidIgnoreRevsFileWarning": false,
4611+
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false
46134612
},
46144613
"properties": {
46154614
"suppressCommitHasNoPreviousCommitWarning": {

src/env/node/git/git.ts

Lines changed: 1 addition & 3 deletions
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 {

src/env/node/git/localGitProvider.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,25 +1255,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
12551255
}
12561256

12571257
@log()
1258-
createBranch(repoPath: string, name: string, ref: string): Promise<void> {
1258+
async createBranch(repoPath: string, name: string, ref: string): Promise<void> {
12591259
try {
1260-
return void this.git.branch(repoPath, name, ref);
1260+
await this.git.branch(repoPath, name, ref);
12611261
} catch (ex) {
12621262
if (ex instanceof BranchError) {
1263-
throw ex.WithBranch(branch.name);
1263+
throw ex.WithBranch(name);
12641264
}
12651265

12661266
throw ex;
12671267
}
12681268
}
12691269

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

12791279
throw ex;
@@ -1308,7 +1308,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13081308
}
13091309

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

@@ -1318,8 +1318,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
13181318
await this.git.branch(repoPath, ...args, branch.ref);
13191319
} catch (ex) {
13201320
// If it fails, restore the remote branch
1321-
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, commit);
1322-
await this.git.branch__set_upstream(repoPath, branch, remote, branch);
1321+
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, remoteCommit?.[0] ?? '');
1322+
await this.git.branch__set_upstream(repoPath, branch.name, remote, branch.ref);
13231323
throw ex;
13241324
}
13251325

0 commit comments

Comments
 (0)