Browse Source

Changes to use UInt8Array

Renames content method for clarity
main
Eric Amodio 2 years ago
parent
commit
39aa720464
4 changed files with 8 additions and 10 deletions
  1. +2
    -2
      src/env/node/git/localGitProvider.ts
  2. +2
    -4
      src/git/fsProvider.ts
  3. +1
    -1
      src/git/gitProvider.ts
  4. +3
    -3
      src/git/gitProviderService.ts

+ 2
- 2
src/env/node/git/localGitProvider.ts View File

@ -3299,8 +3299,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
} }
@log() @log()
getVersionedFileBuffer(repoPath: string, fileName: string, ref: string): Promise<Buffer | undefined> {
return Git.show<Buffer>(repoPath, fileName, ref, { encoding: 'buffer' });
getRevisionContent(repoPath: string, path: string, ref: string): Promise<Uint8Array | undefined> {
return Git.show<Buffer>(repoPath, path, ref, { encoding: 'buffer' });
} }
@log() @log()

+ 2
- 4
src/git/fsProvider.ts View File

@ -83,10 +83,8 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable {
if (ref === GitRevision.deletedOrMissing) return emptyArray; 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<void> { rename(): void | Thenable<void> {

+ 1
- 1
src/git/gitProvider.ts View File

@ -339,7 +339,7 @@ export interface GitProvider {
): Promise<PagedResult<GitTag>>; ): Promise<PagedResult<GitTag>>;
getTreeEntryForRevision(repoPath: string, path: string, ref: string): Promise<GitTreeEntry | undefined>; getTreeEntryForRevision(repoPath: string, path: string, ref: string): Promise<GitTreeEntry | undefined>;
getTreeForRevision(repoPath: string, ref: string): Promise<GitTreeEntry[]>; getTreeForRevision(repoPath: string, ref: string): Promise<GitTreeEntry[]>;
getVersionedFileBuffer(repoPath: string, fileName: string, ref: string): Promise<Buffer | undefined>;
getRevisionContent(repoPath: string, path: string, ref: string): Promise<Uint8Array | undefined>;
getVersionedUri(repoPath: string, fileName: string, ref: string | undefined): Promise<Uri | undefined>; getVersionedUri(repoPath: string, fileName: string, ref: string | undefined): Promise<Uri | undefined>;
getWorkingUri(repoPath: string, uri: Uri): Promise<Uri | undefined>; getWorkingUri(repoPath: string, uri: Uri): Promise<Uri | undefined>;

+ 3
- 3
src/git/gitProviderService.ts View File

@ -1675,9 +1675,9 @@ export class GitProviderService implements Disposable {
} }
@log() @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<Uint8Array | undefined> {
const { provider, path: rp } = this.getProvider(repoPath);
return provider.getRevisionContent(rp, path, ref);
} }
@log() @log()

Loading…
Cancel
Save