Ver a proveniência

Renames GitTree since its an entry

main
Eric Amodio há 2 anos
ascendente
cometimento
9420d6db66
6 ficheiros alterados com 25 adições e 25 eliminações
  1. +5
    -5
      src/env/node/git/localGitProvider.ts
  2. +5
    -5
      src/git/fsProvider.ts
  3. +3
    -3
      src/git/gitProvider.ts
  4. +8
    -8
      src/git/gitProviderService.ts
  5. +1
    -1
      src/git/models/tree.ts
  6. +3
    -3
      src/git/parsers/treeParser.ts

+ 5
- 5
src/env/node/git/localGitProvider.ts Ver ficheiro

@ -64,7 +64,7 @@ import {
GitStatus,
GitStatusFile,
GitTag,
GitTree,
GitTreeEntry,
GitUser,
PullRequest,
PullRequestState,
@ -3282,16 +3282,16 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
@log()
async getTreeFileForRevision(repoPath: string, fileName: string, ref: string): Promise<GitTree | undefined> {
if (repoPath == null || fileName == null || fileName.length === 0) return undefined;
async getTreeEntryForRevision(repoPath: string, path: string, ref: string): Promise<GitTreeEntry | undefined> {
if (repoPath == null || !path) return undefined;
const data = await Git.ls_tree(repoPath, ref, { fileName: fileName });
const data = await Git.ls_tree(repoPath, ref, { fileName: path });
const trees = GitTreeParser.parse(data);
return trees?.length ? trees[0] : undefined;
}
@log()
async getTreeForRevision(repoPath: string, ref: string): Promise<GitTree[]> {
async getTreeForRevision(repoPath: string, ref: string): Promise<GitTreeEntry[]> {
if (repoPath == null) return [];
const data = await Git.ls_tree(repoPath, ref);

+ 5
- 5
src/git/fsProvider.ts Ver ficheiro

@ -16,7 +16,7 @@ import { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { debug, Iterables, TernarySearchTree } from '../system';
import { normalizePath, relative } from '../system/path';
import { GitRevision, GitTree } from './models';
import { GitRevision, GitTreeEntry } from './models';
const emptyArray = new Uint8Array(0);
@ -31,7 +31,7 @@ export function toGitLensFSUri(ref: string, repoPath: string): Uri {
export class GitFileSystemProvider implements FileSystemProvider, Disposable {
private readonly _disposable: Disposable;
private readonly _searchTreeMap = new Map<string, Promise<TernarySearchTree<string, GitTree>>>();
private readonly _searchTreeMap = new Map<string, Promise<TernarySearchTree<string, GitTreeEntry>>>();
constructor(private readonly container: Container) {
this._disposable = Disposable.from(
@ -69,7 +69,7 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable {
if (tree === undefined) throw FileSystemError.FileNotFound(uri);
const items = [
...Iterables.map<GitTree, [string, FileType]>(tree, t => [
...Iterables.map<GitTreeEntry, [string, FileType]>(tree, t => [
path != null && path.length !== 0 ? normalizePath(relative(path, t.path)) : t.path,
typeToFileType(t.type),
]),
@ -125,7 +125,7 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable {
};
}
treeItem = await this.container.git.getTreeFileForRevision(repoPath, path, ref);
treeItem = await this.container.git.getTreeEntryForRevision(repoPath, path, ref);
}
if (treeItem === undefined) {
@ -153,7 +153,7 @@ export class GitFileSystemProvider implements FileSystemProvider, Disposable {
}
private async createSearchTree(ref: string, repoPath: string) {
const searchTree = TernarySearchTree.forPaths<GitTree>();
const searchTree = TernarySearchTree.forPaths<GitTreeEntry>();
const trees = await this.container.git.getTreeForRevision(repoPath, ref);
// Add a fake root folder so that searches will work

+ 3
- 3
src/git/gitProvider.ts Ver ficheiro

@ -24,7 +24,7 @@ import {
GitStatus,
GitStatusFile,
GitTag,
GitTree,
GitTreeEntry,
GitUser,
Repository,
RepositoryChangeEvent,
@ -337,8 +337,8 @@ export interface GitProvider {
repoPath: string | undefined,
options?: { filter?: ((t: GitTag) => boolean) | undefined; sort?: boolean | TagSortOptions | undefined },
): Promise<PagedResult<GitTag>>;
getTreeFileForRevision(repoPath: string, fileName: string, ref: string): Promise<GitTree | undefined>;
getTreeForRevision(repoPath: string, ref: string): Promise<GitTree[]>;
getTreeEntryForRevision(repoPath: string, path: string, ref: string): Promise<GitTreeEntry | undefined>;
getTreeForRevision(repoPath: string, ref: string): Promise<GitTreeEntry[]>;
getVersionedFileBuffer(repoPath: string, fileName: string, ref: string): Promise<Buffer | undefined>;
getVersionedUri(repoPath: string, fileName: string, ref: string | undefined): Promise<Uri | undefined>;
getWorkingUri(repoPath: string, uri: Uri): Promise<Uri | undefined>;

+ 8
- 8
src/git/gitProviderService.ts Ver ficheiro

@ -63,7 +63,7 @@ import {
GitStatus,
GitStatusFile,
GitTag,
GitTree,
GitTreeEntry,
GitUser,
PullRequest,
PullRequestDateFormatting,
@ -1655,19 +1655,19 @@ export class GitProviderService implements Disposable {
}
@log()
async getTreeFileForRevision(
async getTreeEntryForRevision(
repoPath: string | Uri | undefined,
fileName: string,
path: string,
ref: string,
): Promise<GitTree | undefined> {
if (repoPath == null || fileName == null || fileName.length === 0) return undefined;
): Promise<GitTreeEntry | undefined> {
if (repoPath == null || !path) return undefined;
const { provider, path } = this.getProvider(repoPath);
return provider.getTreeFileForRevision(path, fileName, ref);
const { provider, path: rp } = this.getProvider(repoPath);
return provider.getTreeEntryForRevision(rp, path, ref);
}
@log()
async getTreeForRevision(repoPath: string | Uri | undefined, ref: string): Promise<GitTree[]> {
async getTreeForRevision(repoPath: string | Uri | undefined, ref: string): Promise<GitTreeEntry[]> {
if (repoPath == null) return [];
const { provider, path } = this.getProvider(repoPath);

+ 1
- 1
src/git/models/tree.ts Ver ficheiro

@ -1,6 +1,6 @@
'use strict';
export interface GitTree {
export interface GitTreeEntry {
commitSha: string;
path: string;
size: number;

+ 3
- 3
src/git/parsers/treeParser.ts Ver ficheiro

@ -1,16 +1,16 @@
'use strict';
import { debug } from '../../system';
import { GitTree } from '../models';
import { GitTreeEntry } from '../models';
const emptyStr = '';
const treeRegex = /(?:.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+)/gm;
export class GitTreeParser {
@debug({ args: false, singleLine: true })
static parse(data: string | undefined): GitTree[] | undefined {
static parse(data: string | undefined): GitTreeEntry[] | undefined {
if (!data) return undefined;
const trees: GitTree[] = [];
const trees: GitTreeEntry[] = [];
let type;
let sha;

Carregando…
Cancelar
Guardar