From 39aa7204645ba2d041d69e460b49ec8b9960a27d Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 20 Jan 2022 15:09:50 -0500 Subject: [PATCH] Changes to use UInt8Array Renames content method for clarity --- src/env/node/git/localGitProvider.ts | 4 ++-- src/git/fsProvider.ts | 6 ++---- src/git/gitProvider.ts | 2 +- src/git/gitProviderService.ts | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index fdeea01..53d5880 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -3299,8 +3299,8 @@ export class LocalGitProvider implements GitProvider, Disposable { } @log() - getVersionedFileBuffer(repoPath: string, fileName: string, ref: string): Promise { - return Git.show(repoPath, fileName, ref, { encoding: 'buffer' }); + getRevisionContent(repoPath: string, path: string, ref: string): Promise { + return Git.show(repoPath, path, ref, { encoding: 'buffer' }); } @log() diff --git a/src/git/fsProvider.ts b/src/git/fsProvider.ts index 1651bc7..95faaa9 100644 --- a/src/git/fsProvider.ts +++ b/src/git/fsProvider.ts @@ -83,10 +83,8 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable { if (ref === GitRevision.deletedOrMissing) return emptyArray; - const buffer = await this.container.git.getVersionedFileBuffer(repoPath, path, ref); - if (buffer === undefined) return emptyArray; - - return buffer; + const data = await this.container.git.getRevisionContent(repoPath, path, ref); + return data != null ? data : emptyArray; } rename(): void | Thenable { diff --git a/src/git/gitProvider.ts b/src/git/gitProvider.ts index 40f73a8..0cf73f2 100644 --- a/src/git/gitProvider.ts +++ b/src/git/gitProvider.ts @@ -339,7 +339,7 @@ export interface GitProvider { ): Promise>; getTreeEntryForRevision(repoPath: string, path: string, ref: string): Promise; getTreeForRevision(repoPath: string, ref: string): Promise; - getVersionedFileBuffer(repoPath: string, fileName: string, ref: string): Promise; + getRevisionContent(repoPath: string, path: string, ref: string): Promise; getVersionedUri(repoPath: string, fileName: string, ref: string | undefined): Promise; getWorkingUri(repoPath: string, uri: Uri): Promise; diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index c0e2a8b..326131e 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -1675,9 +1675,9 @@ export class GitProviderService implements Disposable { } @log() - getVersionedFileBuffer(repoPath: string | Uri, fileName: string, ref: string) { - const { provider, path } = this.getProvider(repoPath); - return provider.getVersionedFileBuffer(path, fileName, ref); + getRevisionContent(repoPath: string | Uri, path: string, ref: string): Promise { + const { provider, path: rp } = this.getProvider(repoPath); + return provider.getRevisionContent(rp, path, ref); } @log()