Git diff fails with GitFileSystemProvider Repository not found on Windows
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Not tested yet (failure is emitted by built-in vscode.git)
- VS Code Version: 1.134.0
- VS Code Commit: 110a328ea54b42367b803ec53ee0bf52ef26b419
- OS Version: Windows_NT x64 10.0.26200
- Git Version: 2.41.0.windows.1
Steps to Reproduce:
1. Open a Git repository directly as the VS Code workspace (the repository root is the workspace, not the drive root).
2. Modify an existing tracked file.
3. Open Source Control and click the modified file to open its diff.
4. The diff editor fails to load. Reloading the window does not resolve it.
Expected: The built-in Git diff editor opens the modified file.
Actual: VS Code reports:
```text
Unable to read file 'git:/d:/.../watch_main.c?{"path":"d:\\...\\watch_main.c","ref":"~"}'
(Error: Unable to resolve nonexistent file ...)
```
Git extension log:
```text
[Model][openRepository] Opened repository (path): d:\\...\\LVGL_PC_V9
[Model][doInitialScan] Initial repository scan completed - repositories (1)
[GitFileSystemProvider][readFile] Repository not found - git:/d:/.../watch_main.c?{"path":"d:\\...\\watch_main.c","ref":"~"}
```
The repository and file are valid. Git CLI from the same workspace succeeds:
```text
git status --short --branch
## main
M lvgl/demos/watch_demo/watch_main.c
git show HEAD:lvgl/demos/watch_demo/watch_main.c # succeeds
git show :lvgl/demos/watch_demo/watch_main.c # succeeds
git diff -- lvgl/demos/watch_demo/watch_main.c # succeeds
```
The error is repeated before and after the repository initial scan. No Git lock files are present. The current change is only whitespace in a tracked C file.
Related: #297275 has the same git: URI error but only reports opening the drive root as the workspace. This reproduces with the repository itself opened as the workspace.
Contributor guide
Assessment
This issue has not been assessed yet.