Skip to content

Commit b8b4db3

Browse files
authored
Git - cleanup vscode-merge-base git config key when deleteing a branch (microsoft#236716)
1 parent d8c2678 commit b8b4db3

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

extensions/git/src/git.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,11 @@ export class Repository {
11661166
return this.git.spawn(args, options);
11671167
}
11681168

1169-
async config(scope: string, key: string, value: any = null, options: SpawnOptions = {}): Promise<string> {
1170-
const args = ['config'];
1169+
async config(command: string, scope: string, key: string, value: any = null, options: SpawnOptions = {}): Promise<string> {
1170+
const args = ['config', command];
11711171

11721172
if (scope) {
1173-
args.push('--' + scope);
1173+
args.push(`--${scope}`);
11741174
}
11751175

11761176
args.push(key);

extensions/git/src/repository.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,15 +1082,15 @@ export class Repository implements Disposable {
10821082
}
10831083

10841084
getConfig(key: string): Promise<string> {
1085-
return this.run(Operation.Config(true), () => this.repository.config('local', key));
1085+
return this.run(Operation.Config(true), () => this.repository.config('get', 'local', key));
10861086
}
10871087

10881088
getGlobalConfig(key: string): Promise<string> {
1089-
return this.run(Operation.Config(true), () => this.repository.config('global', key));
1089+
return this.run(Operation.Config(true), () => this.repository.config('get', 'global', key));
10901090
}
10911091

10921092
setConfig(key: string, value: string): Promise<string> {
1093-
return this.run(Operation.Config(false), () => this.repository.config('local', key, value));
1093+
return this.run(Operation.Config(false), () => this.repository.config('set', 'local', key, value));
10941094
}
10951095

10961096
log(options?: LogOptions & { silent?: boolean }): Promise<Commit[]> {
@@ -1465,7 +1465,10 @@ export class Repository implements Disposable {
14651465
}
14661466

14671467
async deleteBranch(name: string, force?: boolean): Promise<void> {
1468-
await this.run(Operation.DeleteBranch, () => this.repository.deleteBranch(name, force));
1468+
return this.run(Operation.DeleteBranch, async () => {
1469+
await this.repository.deleteBranch(name, force);
1470+
await this.repository.config('unset', 'local', `branch.${name}.vscode-merge-base`);
1471+
});
14691472
}
14701473

14711474
async renameBranch(name: string): Promise<void> {

0 commit comments

Comments
 (0)