mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
Git - FS stat should also throw if the file does not exist (#238395)
This commit is contained in:
@@ -140,14 +140,14 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
throw FileSystemError.FileNotFound();
|
||||
}
|
||||
|
||||
let size = 0;
|
||||
try {
|
||||
const details = await repository.getObjectDetails(sanitizeRef(ref, path, repository), path);
|
||||
size = details.size;
|
||||
return { type: FileType.File, size: details.size, mtime: this.mtime, ctime: 0 };
|
||||
} catch {
|
||||
// noop
|
||||
// File does not exist in git. This could be because the file is untracked or ignored
|
||||
this.logger.warn(`[GitFileSystemProvider][stat] File not found - ${uri.toString()}`);
|
||||
throw FileSystemError.FileNotFound();
|
||||
}
|
||||
return { type: FileType.File, size: size, mtime: this.mtime, ctime: 0 };
|
||||
}
|
||||
|
||||
readDirectory(): Thenable<[string, FileType][]> {
|
||||
@@ -193,10 +193,9 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
|
||||
try {
|
||||
return await repository.buffer(sanitizeRef(ref, path, repository), path);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// File does not exist in git. This could be because the file is untracked or ignored
|
||||
this.logger.warn(`[GitFileSystemProvider][readFile] File not found - ${uri.toString()}`);
|
||||
// File does not exist in git. This could be
|
||||
// because the file is untracked or ignored
|
||||
throw FileSystemError.FileNotFound();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user