Skip to content

Commit dac43a8

Browse files
committed
rebase, lint & code fixes
1 parent 2f17ba7 commit dac43a8

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,23 +4682,22 @@
46824682
"gitlens.advanced.messages": {
46834683
"type": "object",
46844684
"default": {
4685-
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false,
4686-
"suppressBlameInvalidIgnoreRevsFileWarning": false,
46874685
"suppressCommitHasNoPreviousCommitWarning": false,
46884686
"suppressCommitNotFoundWarning": false,
46894687
"suppressCreatePullRequestPrompt": false,
46904688
"suppressDebugLoggingWarning": false,
46914689
"suppressFileNotUnderSourceControlWarning": false,
4692-
"suppressGitBranchNotFullyMergedWarning": false,
46934690
"suppressGitDisabledWarning": false,
46944691
"suppressGitMissingWarning": false,
46954692
"suppressGitVersionWarning": false,
4693+
"suppressLineUncommittedWarning": false,
4694+
"suppressNoRepositoryWarning": false,
4695+
"suppressRebaseSwitchToTextWarning": false,
46964696
"suppressIntegrationDisconnectedTooManyFailedRequestsWarning": false,
46974697
"suppressIntegrationRequestFailed500Warning": false,
46984698
"suppressIntegrationRequestTimedOutWarning": false,
4699-
"suppressLineUncommittedWarning": false,
4700-
"suppressNoRepositoryWarning": false,
4701-
"suppressRebaseSwitchToTextWarning": false
4699+
"suppressBlameInvalidIgnoreRevsFileWarning": false,
4700+
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false
47024701
},
47034702
"properties": {
47044703
"suppressCommitHasNoPreviousCommitWarning": {

src/env/node/git/git.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,11 @@ function getStdinUniqueKey(): number {
171171
type ExitCodeOnlyGitCommandOptions = GitCommandOptions & { exitCodeOnly: true };
172172
export type PushForceOptions = { withLease: true; ifIncludes?: boolean } | { withLease: false; ifIncludes?: never };
173173

174-
const branchErrorAndReason = [
174+
const branchErrorAndReason: [RegExp, BranchErrorReason][] = [
175175
[GitErrors.noRemoteReference, BranchErrorReason.NoRemoteReference],
176176
[GitErrors.invalidBranchName, BranchErrorReason.InvalidBranchName],
177177
[GitErrors.branchAlreadyExists, BranchErrorReason.BranchAlreadyExists],
178178
[GitErrors.branchNotFullyMerged, BranchErrorReason.BranchNotFullyMerged],
179-
[GitErrors.branchNotYetBorn, BranchErrorReason.BranchNotYetBorn],
180-
[GitErrors.branchFastForwardRejected, BranchErrorReason.BranchFastForwardRejected],
181179
];
182180

183181
const tagErrorAndReason: [RegExp, TagErrorReason][] = [

src/env/node/git/localGitProvider.ts

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

12581258
@log()
1259-
createBranch(repoPath: string, name: string, ref: string): Promise<void> {
1259+
async createBranch(repoPath: string, name: string, ref: string): Promise<void> {
12601260
try {
1261-
return void this.git.branch(repoPath, name, ref);
1261+
await this.git.branch(repoPath, name, ref);
12621262
} catch (ex) {
12631263
if (ex instanceof BranchError) {
1264-
throw ex.WithBranch(branch.name);
1264+
throw ex.WithBranch(name);
12651265
}
12661266

12671267
throw ex;
12681268
}
12691269
}
12701270

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

12801280
throw ex;
@@ -1309,7 +1309,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13091309
}
13101310

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

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

src/git/models/repository.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import { configuration } from '../../system/vscode/configuration';
2626
import type { GitProviderDescriptor, GitProviderRepository } from '../gitProvider';
2727
import type { GitProviderService } from '../gitProviderService';
2828
import type { GitBranch } from './branch';
29-
import type { GitBranchReference, GitReference, GitTagReference } from './reference';
30-
import { getNameWithoutRemote, isBranchReference } from './reference';
31-
import { getBranchNameWithoutRemote, getRemoteNameFromBranchName } from './branch';
29+
import type { GitBranchReference, GitReference } from './reference';
30+
import { isBranchReference } from './reference';
3231
import type { GitRemote } from './remote';
3332
import type { GitWorktree } from './worktree';
3433

0 commit comments

Comments
 (0)