@@ -308,11 +308,14 @@ export const enum Operation {
308
308
Diff = 'Diff' ,
309
309
MergeBase = 'MergeBase' ,
310
310
Add = 'Add' ,
311
+ AddNoProgress = 'AddNoProgress' ,
311
312
Remove = 'Remove' ,
312
313
RevertFiles = 'RevertFiles' ,
314
+ RevertFilesNoProgress = 'RevertFilesNoProgress' ,
313
315
Commit = 'Commit' ,
314
316
PostCommitCommand = 'PostCommitCommand' ,
315
317
Clean = 'Clean' ,
318
+ CleanNoProgress = 'CleanNoProgress' ,
316
319
Branch = 'Branch' ,
317
320
GetBranch = 'GetBranch' ,
318
321
GetBranches = 'GetBranches' ,
@@ -376,7 +379,10 @@ function isReadOnly(operation: Operation): boolean {
376
379
377
380
function shouldShowProgress ( operation : Operation ) : boolean {
378
381
switch ( operation ) {
382
+ case Operation . AddNoProgress :
383
+ case Operation . CleanNoProgress :
379
384
case Operation . FetchNoProgress :
385
+ case Operation . RevertFilesNoProgress :
380
386
case Operation . CheckIgnore :
381
387
case Operation . GetObjectDetails :
382
388
case Operation . Show :
@@ -1225,8 +1231,12 @@ export class Repository implements Disposable {
1225
1231
}
1226
1232
1227
1233
async add ( resources : Uri [ ] , opts ?: { update ?: boolean } ) : Promise < void > {
1234
+ const config = workspace . getConfiguration ( 'git' , Uri . file ( this . root ) ) ;
1235
+ const optimisticUpdate = config . get < boolean > ( 'optimisticUpdate' ) === true ;
1236
+ const operation = optimisticUpdate ? Operation . AddNoProgress : Operation . Add ;
1237
+
1228
1238
await this . run (
1229
- Operation . Add ,
1239
+ operation ,
1230
1240
async ( ) => {
1231
1241
await this . repository . add ( resources . map ( r => r . fsPath ) , opts ) ;
1232
1242
this . closeDiffEditors ( [ ] , [ ...resources . map ( r => r . fsPath ) ] ) ;
@@ -1276,8 +1286,12 @@ export class Repository implements Disposable {
1276
1286
}
1277
1287
1278
1288
async revert ( resources : Uri [ ] ) : Promise < void > {
1289
+ const config = workspace . getConfiguration ( 'git' , Uri . file ( this . root ) ) ;
1290
+ const optimisticUpdate = config . get < boolean > ( 'optimisticUpdate' ) === true ;
1291
+ const operation = optimisticUpdate ? Operation . RevertFilesNoProgress : Operation . RevertFiles ;
1292
+
1279
1293
await this . run (
1280
- Operation . RevertFiles ,
1294
+ operation ,
1281
1295
async ( ) => {
1282
1296
await this . repository . revert ( 'HEAD' , resources . map ( r => r . fsPath ) ) ;
1283
1297
this . closeDiffEditors ( [ ...resources . length !== 0 ?
@@ -1387,8 +1401,12 @@ export class Repository implements Disposable {
1387
1401
}
1388
1402
1389
1403
async clean ( resources : Uri [ ] ) : Promise < void > {
1404
+ const config = workspace . getConfiguration ( 'git' , Uri . file ( this . root ) ) ;
1405
+ const optimisticUpdate = config . get < boolean > ( 'optimisticUpdate' ) === true ;
1406
+ const operation = optimisticUpdate ? Operation . CleanNoProgress : Operation . Clean ;
1407
+
1390
1408
await this . run (
1391
- Operation . Clean ,
1409
+ operation ,
1392
1410
async ( ) => {
1393
1411
const toClean : string [ ] = [ ] ;
1394
1412
const toCheckout : string [ ] = [ ] ;
0 commit comments