Skip to content

Commit

Permalink
Git - handle the diff editor for untracked files now that we throw `F…
Browse files Browse the repository at this point in the history
…ileNotFound` if the file does not exist (#236863)
  • Loading branch information
lszomoru authored Dec 24, 2024
1 parent fca210c commit 4fa5611
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion extensions/git/src/fileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
2 changes: 0 additions & 2 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4fa5611

Please sign in to comment.