Close stale diff editors while stashing changes

This commit is contained in:
Ladislau Szomoru 2022-02-14 10:32:59 +01:00
parent aed7eb754a
commit 888677ed95
No known key found for this signature in database
GPG key ID: 2B88287CB9DB080B
2 changed files with 10 additions and 2 deletions

View file

@ -175,7 +175,7 @@
"config.confirmForcePush": "Controls whether to ask for confirmation before force-pushing.",
"config.allowNoVerifyCommit": "Controls whether commits without running pre-commit and commit-msg hooks are allowed.",
"config.confirmNoVerifyCommit": "Controls whether to ask for confirmation before committing without verification.",
"config.closeDiffOnOperation": "Controls whether the diff editor should be automatically closed when changes are committed, discarded, staged, or unstaged.",
"config.closeDiffOnOperation": "Controls whether the diff editor should be automatically closed when changes are stashed, committed, discarded, staged, or unstaged.",
"config.openDiffOnClick": "Controls whether the diff editor should be opened when clicking a change. Otherwise the regular editor will be opened.",
"config.supportCancellation": "Controls whether a notification comes up when running the Sync action, which allows the user to cancel the operation.",
"config.branchSortOrder": "Controls the sort order for branches.",

View file

@ -1636,7 +1636,15 @@ export class Repository implements Disposable {
}
async createStash(message?: string, includeUntracked?: boolean): Promise<void> {
return await this.run(Operation.Stash, () => this.repository.createStash(message, includeUntracked));
const indexResources = [...this.indexGroup.resourceStates.map(r => r.resourceUri.fsPath)];
const workingGroupResources = [
...this.workingTreeGroup.resourceStates.map(r => r.resourceUri.fsPath),
...includeUntracked ? this.untrackedGroup.resourceStates.map(r => r.resourceUri.fsPath) : []];
return await this.run(Operation.Stash, async () => {
this.repository.createStash(message, includeUntracked);
this.closeDiffEditors(indexResources, workingGroupResources);
});
}
async popStash(index?: number): Promise<void> {