diff options
author | Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> | 2022-11-11 19:11:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 19:11:41 +0300 |
commit | b4fbff3218b1ec6102b44ff4283f523019ceb2f9 (patch) | |
tree | 1fc88e5c4c32f6199be89043d11d523321f5edfe | |
parent | f08b79d3176a0e8f2954f002ab60eda12928747b (diff) |
Git - Don't show progress for commands that support optimistic UI updates (#166124)
Don't show progress for commands that support optimistic UI updates
-rw-r--r-- | extensions/git/src/repository.ts | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index ef7977ae46d..e06ef71489c 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -308,11 +308,14 @@ export const enum Operation { Diff = 'Diff', MergeBase = 'MergeBase', Add = 'Add', + AddNoProgress = 'AddNoProgress', Remove = 'Remove', RevertFiles = 'RevertFiles', + RevertFilesNoProgress = 'RevertFilesNoProgress', Commit = 'Commit', PostCommitCommand = 'PostCommitCommand', Clean = 'Clean', + CleanNoProgress = 'CleanNoProgress', Branch = 'Branch', GetBranch = 'GetBranch', GetBranches = 'GetBranches', @@ -376,7 +379,10 @@ function isReadOnly(operation: Operation): boolean { function shouldShowProgress(operation: Operation): boolean { switch (operation) { + case Operation.AddNoProgress: + case Operation.CleanNoProgress: case Operation.FetchNoProgress: + case Operation.RevertFilesNoProgress: case Operation.CheckIgnore: case Operation.GetObjectDetails: case Operation.Show: @@ -1225,8 +1231,12 @@ export class Repository implements Disposable { } async add(resources: Uri[], opts?: { update?: boolean }): Promise<void> { + const config = workspace.getConfiguration('git', Uri.file(this.root)); + const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true; + const operation = optimisticUpdate ? Operation.AddNoProgress : Operation.Add; + await this.run( - Operation.Add, + operation, async () => { await this.repository.add(resources.map(r => r.fsPath), opts); this.closeDiffEditors([], [...resources.map(r => r.fsPath)]); @@ -1276,8 +1286,12 @@ export class Repository implements Disposable { } async revert(resources: Uri[]): Promise<void> { + const config = workspace.getConfiguration('git', Uri.file(this.root)); + const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true; + const operation = optimisticUpdate ? Operation.RevertFilesNoProgress : Operation.RevertFiles; + await this.run( - Operation.RevertFiles, + operation, async () => { await this.repository.revert('HEAD', resources.map(r => r.fsPath)); this.closeDiffEditors([...resources.length !== 0 ? @@ -1387,8 +1401,12 @@ export class Repository implements Disposable { } async clean(resources: Uri[]): Promise<void> { + const config = workspace.getConfiguration('git', Uri.file(this.root)); + const optimisticUpdate = config.get<boolean>('optimisticUpdate') === true; + const operation = optimisticUpdate ? Operation.CleanNoProgress : Operation.Clean; + await this.run( - Operation.Clean, + operation, async () => { const toClean: string[] = []; const toCheckout: string[] = []; |