From ca3ff9f56444da1bfa4d942e7fea9154deeffbf9 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:26:30 +0100 Subject: [PATCH] SCM - quick diff should better handle untracked files (#236315) --- extensions/git/src/repository.ts | 8 +++++++- src/vs/workbench/contrib/scm/browser/quickDiffModel.ts | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 73a54cef4afaa..21dd3b5819fab 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -1035,7 +1035,13 @@ export class Repository implements Disposable { } // Ignore path that is inside a merge group - if (this.mergeGroup.resourceStates.some(r => r.resourceUri.path === uri.path)) { + if (this.mergeGroup.resourceStates.some(r => pathEquals(r.resourceUri.fsPath, uri.fsPath))) { + return undefined; + } + + // Ignore path that is untracked + if (this.untrackedGroup.resourceStates.some(r => pathEquals(r.resourceUri.path, uri.path)) || + this.workingTreeGroup.resourceStates.some(r => pathEquals(r.resourceUri.path, uri.path) && r.type === Status.UNTRACKED)) { return undefined; } diff --git a/src/vs/workbench/contrib/scm/browser/quickDiffModel.ts b/src/vs/workbench/contrib/scm/browser/quickDiffModel.ts index 3d1ec39c3f61b..bf9494da91cf0 100644 --- a/src/vs/workbench/contrib/scm/browser/quickDiffModel.ts +++ b/src/vs/workbench/contrib/scm/browser/quickDiffModel.ts @@ -214,10 +214,6 @@ export class QuickDiffModel extends Disposable { return; // disposed } - if (editorModels.every(editorModel => editorModel.textEditorModel.getValueLength() === 0)) { - result.changes = []; - } - this.setChanges(result.changes, result.mapChanges); }) .catch(err => onUnexpectedError(err));