Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0d9b1d0

Browse files
committedDec 12, 2024
rebase, lint & code fixes
1 parent 149bdcb commit 0d9b1d0

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
@@ -4717,23 +4717,22 @@
47174717
"gitlens.advanced.messages": {
47184718
"type": "object",
47194719
"default": {
4720-
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false,
4721-
"suppressBlameInvalidIgnoreRevsFileWarning": false,
47224720
"suppressCommitHasNoPreviousCommitWarning": false,
47234721
"suppressCommitNotFoundWarning": false,
47244722
"suppressCreatePullRequestPrompt": false,
47254723
"suppressDebugLoggingWarning": false,
47264724
"suppressFileNotUnderSourceControlWarning": false,
4727-
"suppressGitBranchNotFullyMergedWarning": false,
47284725
"suppressGitDisabledWarning": false,
47294726
"suppressGitMissingWarning": false,
47304727
"suppressGitVersionWarning": false,
4728+
"suppressLineUncommittedWarning": false,
4729+
"suppressNoRepositoryWarning": false,
4730+
"suppressRebaseSwitchToTextWarning": false,
47314731
"suppressIntegrationDisconnectedTooManyFailedRequestsWarning": false,
47324732
"suppressIntegrationRequestFailed500Warning": false,
47334733
"suppressIntegrationRequestTimedOutWarning": false,
4734-
"suppressLineUncommittedWarning": false,
4735-
"suppressNoRepositoryWarning": false,
4736-
"suppressRebaseSwitchToTextWarning": false
4734+
"suppressBlameInvalidIgnoreRevsFileWarning": false,
4735+
"suppressBlameInvalidIgnoreRevsFileBadRevisionWarning": false
47374736
},
47384737
"properties": {
47394738
"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
@@ -1277,25 +1277,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
12771277
}
12781278

12791279
@log()
1280-
createBranch(repoPath: string, name: string, ref: string): Promise<void> {
1280+
async createBranch(repoPath: string, name: string, ref: string): Promise<void> {
12811281
try {
1282-
return void this.git.branch(repoPath, name, ref);
1282+
await this.git.branch(repoPath, name, ref);
12831283
} catch (ex) {
12841284
if (ex instanceof BranchError) {
1285-
throw ex.WithBranch(branch.name);
1285+
throw ex.WithBranch(name);
12861286
}
12871287

12881288
throw ex;
12891289
}
12901290
}
12911291

12921292
@log()
1293-
renameBranch(repoPath: string, oldName: string, newName: string): Promise<void> {
1293+
async renameBranch(repoPath: string, oldName: string, newName: string): Promise<void> {
12941294
try {
1295-
return void this.git.branch(repoPath, '-m', oldName, newName);
1295+
await this.git.branch(repoPath, '-m', oldName, newName);
12961296
} catch (ex) {
12971297
if (ex instanceof BranchError) {
1298-
throw ex.WithBranch(branch.name);
1298+
throw ex.WithBranch(oldName);
12991299
}
13001300

13011301
throw ex;
@@ -1330,7 +1330,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13301330
}
13311331

13321332
const remote = getRemoteNameFromBranchName(branch.upstream.name);
1333-
remoteCommit = await this.git.rev_list(repoPath, `refs/remotes/${remote}/${branch.ref}`, {
1333+
const remoteCommit = await this.git.rev_list(repoPath, `refs/remotes/${remote}/${branch.ref}`, {
13341334
maxResults: 1,
13351335
});
13361336

@@ -1340,8 +1340,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
13401340
await this.git.branch(repoPath, ...args, branch.ref);
13411341
} catch (ex) {
13421342
// If it fails, restore the remote branch
1343-
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, commit);
1344-
await this.git.branch__set_upstream(repoPath, branch, remote, branch);
1343+
await this.git.update_ref(repoPath, `refs/remotes/${remote}/${branch.ref}`, remoteCommit?.[0] ?? '');
1344+
await this.git.branch__set_upstream(repoPath, branch.name, remote, branch.ref);
13451345
throw ex;
13461346
}
13471347

‎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)