Git - Optimistic UI updates for rebase continue (#165699)

Optimistic UI updates for rebase continue
This commit is contained in:
Ladislau Szomoru
2022-11-07 15:15:56 +01:00
committed by GitHub
parent af4ea031fb
commit d3611df987

View File

@@ -1265,7 +1265,8 @@ export class Repository implements Disposable {
await this.repository.rebaseContinue();
await this.commitOperationCleanup(message, opts);
});
},
() => this.commitOperationGetOptimisticResourceGroups(opts));
} else {
// Set post-commit command to render the correct action button
this.commitCommandCenter.postCommitCommand = opts.postCommitCommand;
@@ -1288,19 +1289,7 @@ export class Repository implements Disposable {
await this.repository.commit(message, opts);
await this.commitOperationCleanup(message, opts);
},
(): GitResourceGroups => {
let untrackedGroup: Resource[] | undefined = undefined,
workingTreeGroup: Resource[] | undefined = undefined;
if (opts.all === 'tracked') {
workingTreeGroup = this.workingTreeGroup.resourceStates
.filter(r => r.type === Status.UNTRACKED);
} else if (opts.all) {
untrackedGroup = workingTreeGroup = [];
}
return { indexGroup: [], untrackedGroup, workingTreeGroup };
});
() => this.commitOperationGetOptimisticResourceGroups(opts));
// Execute post-commit command
await this.run(Operation.PostCommitCommand, async () => {
@@ -1321,6 +1310,20 @@ export class Repository implements Disposable {
this.closeDiffEditors(indexResources, workingGroupResources);
}
private commitOperationGetOptimisticResourceGroups(opts: CommitOptions): GitResourceGroups {
let untrackedGroup: Resource[] | undefined = undefined,
workingTreeGroup: Resource[] | undefined = undefined;
if (opts.all === 'tracked') {
workingTreeGroup = this.workingTreeGroup.resourceStates
.filter(r => r.type === Status.UNTRACKED);
} else if (opts.all) {
untrackedGroup = workingTreeGroup = [];
}
return { indexGroup: [], mergeGroup: [], untrackedGroup, workingTreeGroup };
}
async clean(resources: Uri[]): Promise<void> {
await this.run(Operation.Clean, async () => {
const toClean: string[] = [];