Git - fileSystemProvider does not return an error when a file does not exist #204231
Description
Does this issue occur when all extensions are disabled?: Yes
Versions
Version : 1.86.0 (Universal)
Validation : 05047486b6df5eb8d44b2ecd70ea3bdf775fd937
Date : 2024-01-31T10:29:15.765Z
Electron : 27.2.3
ElectronBuildId : 26495564
Chromium : 118.0.5993.159
Node.js : 18.17.1
V8 : 11.8.172.18-electron.0
Système d’exploitation : Darwin arm64 23.2.0
Steps to Reproduce:
-
stat
will return aFileStat
even if the file does not exist:vscode/extensions/git/src/fileSystemProvider.ts
Lines 128 to 145 in 559f5be
-
readFile
will return an empty Uint8Array if the file does not exist:vscode/extensions/git/src/fileSystemProvider.ts
Lines 155 to 192 in 559f5be
The documentation is unclear about non existing file but VS Code has a FileSystemError.FileNotFound()
error.
Is that expected? And if so, how can I check if a file exists or not when the Git fileSystemProvider is enabled. I thought about using the size
property but I can't tell if it's an empty file or a non-existing file.
Maybe we should add an extra property to tell if the file exists in the working tree or not? Also, I do think that we should return a FileSystemError.FileNotFound()
when trying to read a file that does not exist in the working tree.
Activity