Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git - fix close diff editor regression #184410

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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