Adds timestamp to GitHub stat requests

This commit is contained in:
Eric Amodio
2020-06-28 23:34:59 -04:00
parent d59430ffaa
commit f61fed5a35
2 changed files with 5 additions and 3 deletions

View File

@@ -353,7 +353,7 @@ export class GitHubApi implements Disposable {
}
private readonly pendingContextRequests = new Map<string, Promise<GitHubApiContext>>();
private async getContext(uri: Uri): Promise<GitHubApiContext> {
async getContext(uri: Uri): Promise<GitHubApiContext> {
const rootUri = getRootUri(uri);
let pending = this.pendingContextRequests.get(rootUri.toString());

View File

@@ -89,8 +89,10 @@ export class GitHubFS implements FileSystemProvider, FileSearchProvider, TextSea
}
async stat(uri: Uri): Promise<FileStat> {
const context = await this.github.getContext(uri);
if (uri.path === '' || uri.path.lastIndexOf('/') === 0) {
return { type: FileType.Directory, size: 0, ctime: 0, mtime: 0 };
return { type: FileType.Directory, size: 0, ctime: 0, mtime: context?.timestamp };
}
const data = await this.fsQuery<{
@@ -109,7 +111,7 @@ export class GitHubFS implements FileSystemProvider, FileSearchProvider, TextSea
type: typenameToFileType(data?.__typename),
size: data?.byteSize ?? 0,
ctime: 0,
mtime: 0,
mtime: context?.timestamp,
};
}