mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:28:52 +01:00
Git - handle submodule HEAD file (#240357)
* Git - handle submodule HEAD file
* 💄
* Better fix
This commit is contained in:
@@ -18,7 +18,7 @@ interface CacheRow {
|
||||
const THREE_MINUTES = 1000 * 60 * 3;
|
||||
const FIVE_MINUTES = 1000 * 60 * 5;
|
||||
|
||||
function sanitizeRef(ref: string, path: string, repository: Repository): string {
|
||||
function sanitizeRef(ref: string, path: string, submoduleOf: string | undefined, repository: Repository): string {
|
||||
if (ref === '~') {
|
||||
const fileUri = Uri.file(path);
|
||||
const uriString = fileUri.toString();
|
||||
@@ -30,6 +30,11 @@ function sanitizeRef(ref: string, path: string, repository: Repository): string
|
||||
return `:${ref[1]}`;
|
||||
}
|
||||
|
||||
// Submodule HEAD
|
||||
if (submoduleOf && (ref === 'index' || ref === 'wt')) {
|
||||
return 'HEAD';
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
@@ -141,7 +146,7 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
}
|
||||
|
||||
try {
|
||||
const details = await repository.getObjectDetails(sanitizeRef(ref, path, repository), path);
|
||||
const details = await repository.getObjectDetails(sanitizeRef(ref, path, submoduleOf, repository), path);
|
||||
return { type: FileType.File, size: details.size, mtime: this.mtime, ctime: 0 };
|
||||
} catch {
|
||||
// Empty tree
|
||||
@@ -198,7 +203,7 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
this.cache.set(uri.toString(), cacheValue);
|
||||
|
||||
try {
|
||||
return await repository.buffer(sanitizeRef(ref, path, repository), path);
|
||||
return await repository.buffer(sanitizeRef(ref, path, submoduleOf, repository), path);
|
||||
} catch {
|
||||
// Empty tree
|
||||
if (ref === await repository.getEmptyTree()) {
|
||||
|
||||
Reference in New Issue
Block a user