mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
Git - fix bug with opening the first commit from the timeline view (#239111)
This commit is contained in:
@@ -144,6 +144,12 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
const details = await repository.getObjectDetails(sanitizeRef(ref, path, repository), path);
|
||||
return { type: FileType.File, size: details.size, mtime: this.mtime, ctime: 0 };
|
||||
} catch {
|
||||
// Empty tree
|
||||
if (ref === await repository.getEmptyTree()) {
|
||||
this.logger.warn(`[GitFileSystemProvider][stat] Empty tree - ${uri.toString()}`);
|
||||
return { type: FileType.File, size: 0, mtime: this.mtime, ctime: 0 };
|
||||
}
|
||||
|
||||
// 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();
|
||||
@@ -194,6 +200,12 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
try {
|
||||
return await repository.buffer(sanitizeRef(ref, path, repository), path);
|
||||
} catch {
|
||||
// Empty tree
|
||||
if (ref === await repository.getEmptyTree()) {
|
||||
this.logger.warn(`[GitFileSystemProvider][readFile] Empty tree - ${uri.toString()}`);
|
||||
return new Uint8Array(0);
|
||||
}
|
||||
|
||||
// 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()}`);
|
||||
throw FileSystemError.FileNotFound();
|
||||
|
||||
Reference in New Issue
Block a user