Skip to content

Commit

Permalink
Git - fix close diff editor regression (#184410)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Jun 6, 2023
1 parent 9d5ee94 commit ad34af0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,10 @@ export class Repository implements Disposable {
}

async commit(message: string | undefined, opts: CommitOptions = Object.create(null)): Promise<void> {
const indexResources = [...this.indexGroup.resourceStates.map(r => r.resourceUri.fsPath)];
const workingGroupResources = opts.all && opts.all !== 'tracked' ?
[...this.workingTreeGroup.resourceStates.map(r => r.resourceUri.fsPath)] : [];

if (this.rebaseCommit) {
await this.run(
Operation.RebaseContinue,
Expand All @@ -1206,7 +1210,7 @@ export class Repository implements Disposable {
}

await this.repository.rebaseContinue();
await this.commitOperationCleanup(message, opts);
await this.commitOperationCleanup(message, indexResources, workingGroupResources);
},
() => this.commitOperationGetOptimisticResourceGroups(opts));
} else {
Expand All @@ -1229,7 +1233,7 @@ export class Repository implements Disposable {
}

await this.repository.commit(message, opts);
await this.commitOperationCleanup(message, opts);
await this.commitOperationCleanup(message, indexResources, workingGroupResources);
},
() => this.commitOperationGetOptimisticResourceGroups(opts));

Expand All @@ -1240,15 +1244,10 @@ export class Repository implements Disposable {
}
}

private async commitOperationCleanup(message: string | undefined, opts: CommitOptions) {
private async commitOperationCleanup(message: string | undefined, indexResources: string[], workingGroupResources: string[]) {
if (message) {
this.inputBox.value = await this.getInputTemplate();
}

const indexResources = [...this.indexGroup.resourceStates.map(r => r.resourceUri.fsPath)];
const workingGroupResources = opts.all && opts.all !== 'tracked' ?
[...this.workingTreeGroup.resourceStates.map(r => r.resourceUri.fsPath)] : [];

this.closeDiffEditors(indexResources, workingGroupResources);
}

Expand Down

0 comments on commit ad34af0

Please sign in to comment.