Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git - handle the diff editor for untracked files now that we throw FileNotFound if the file does not exist #236863

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading