From 4fa5611d67dc84e105e9cd155a746f2d7813d9a0 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 24 Dec 2024 02:02:40 +0100 Subject: [PATCH] Git - handle the diff editor for untracked files now that we throw `FileNotFound` if the file does not exist (#236863) --- extensions/git/src/fileSystemProvider.ts | 3 ++- extensions/git/src/repository.ts | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/fileSystemProvider.ts b/extensions/git/src/fileSystemProvider.ts index 24ae4e6df9a..0847fe8d745 100644 --- a/extensions/git/src/fileSystemProvider.ts +++ b/extensions/git/src/fileSystemProvider.ts @@ -192,7 +192,8 @@ export class GitFileSystemProvider implements FileSystemProvider { try { return await repository.buffer(sanitizeRef(ref, path, repository), path); } catch (err) { - // File does not exist in git (ex: git ignored) + // File does not exist in git. This could be + // because the file is untracked or ignored throw FileSystemError.FileNotFound(); } } diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index ec66d510c72..4bf7fa32ef0 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -560,13 +560,11 @@ class ResourceCommandResolver { switch (resource.type) { case Status.INDEX_MODIFIED: case Status.INDEX_RENAMED: - case Status.INDEX_ADDED: case Status.INTENT_TO_RENAME: case Status.TYPE_CHANGED: return { original: toGitUri(resource.original, 'HEAD') }; case Status.MODIFIED: - case Status.UNTRACKED: return { original: toGitUri(resource.resourceUri, '~') }; case Status.DELETED_BY_US: