Skip to content

Commit 687514b

Browse files
authored
Git - Fix optimistic UI update for untracked changes (microsoft#166277)
1 parent 79f348c commit 687514b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

extensions/git/src/repository.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,9 @@ export class Repository implements Disposable {
12911291
this.indexGroup.resourceStates.map(r => r.resourceUri.fsPath)], []);
12921292
},
12931293
() => {
1294+
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
1295+
const untrackedChanges = config.get<'mixed' | 'separate' | 'hidden'>('untrackedChanges');
1296+
12941297
const resourcePaths = resources.length === 0 ?
12951298
this.indexGroup.resourceStates.map(r => r.resourceUri.fsPath) : resources.map(r => r.fsPath);
12961299

@@ -1312,10 +1315,13 @@ export class Repository implements Disposable {
13121315
.filter(r => !resourcePaths.includes(r.resourceUri.fsPath));
13131316

13141317
// Add resource(s) to working group
1315-
const workingTreeGroup = [...this.workingTreeGroup.resourceStates, ...trackedResources];
1318+
const workingTreeGroup = untrackedChanges === 'mixed' ?
1319+
[...this.workingTreeGroup.resourceStates, ...trackedResources, ...untrackedResources] :
1320+
[...this.workingTreeGroup.resourceStates, ...trackedResources];
13161321

13171322
// Add resource(s) to untracked group
1318-
const untrackedGroup = [...this.untrackedGroup.resourceStates, ...untrackedResources];
1323+
const untrackedGroup = untrackedChanges === 'separate' ?
1324+
[...this.untrackedGroup.resourceStates, ...untrackedResources] : undefined;
13191325

13201326
return { indexGroup, workingTreeGroup, untrackedGroup };
13211327
});

0 commit comments

Comments
 (0)