From fb09ce08a3af0ee28910dc1ad1dea231bec53f65 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 16 Sep 2018 03:05:30 -0400 Subject: [PATCH] Removes unused version uri cache --- src/git/gitService.ts | 18 ------------------ src/git/gitUri.ts | 3 --- src/views/nodes/repositoriesNode.ts | 4 +--- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/git/gitService.ts b/src/git/gitService.ts index fbd5b99..9cb72e4 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -98,12 +98,10 @@ export class GitService implements Disposable { private _repositoriesLoadingPromise: Promise | undefined; private _suspended: boolean = false; private readonly _trackedCache: Map>; - private _versionedUriCache: Map; constructor() { this._repositoryTree = TernarySearchTree.forPaths(); this._trackedCache = new Map(); - this._versionedUriCache = new Map(); this._disposable = Disposable.from( window.onDidChangeWindowState(this.onWindowStateChanged, this), @@ -118,7 +116,6 @@ export class GitService implements Disposable { dispose() { this._repositoryTree.forEach(r => r.dispose()); this._trackedCache.clear(); - this._versionedUriCache.clear(); this._disposable && this._disposable.dispose(); } @@ -1500,11 +1497,6 @@ export class GitService implements Disposable { let repo = await this.getRepository(filePathOrUri, { ...options, skipCacheUpdate: true }); if (repo !== undefined) return repo.path; - if (typeof filePathOrUri !== 'string') { - const versionedUri = await Container.git.getVersionedUri(filePathOrUri); - if (versionedUri !== undefined) return versionedUri.repoPath; - } - const rp = await this.getRepoPathCore( typeof filePathOrUri === 'string' ? filePathOrUri : filePathOrUri.fsPath, false @@ -1708,16 +1700,6 @@ export class GitService implements Disposable { return Git.show(repoPath, fileName, ref, { encoding: 'buffer' }); } - // getVersionedFileText(repoPath: string, fileName: string, ref: string) { - // Logger.log(`getVersionedFileText('${repoPath}', '${fileName}', ${ref})`); - - // return Git.show(repoPath, fileName, ref, { encoding: GitService.getEncoding(repoPath, fileName) }); - // } - - getVersionedUri(uri: Uri) { - return this._versionedUriCache.get(GitUri.toKey(uri)); - } - isTrackable(scheme: string): boolean; isTrackable(uri: Uri): boolean; isTrackable(schemeOruri: string | Uri): boolean { diff --git a/src/git/gitUri.ts b/src/git/gitUri.ts index e927527..f665235 100644 --- a/src/git/gitUri.ts +++ b/src/git/gitUri.ts @@ -218,9 +218,6 @@ export class GitUri extends ((Uri as any) as UriEx) { } as GitCommitish); } - const versionedUri = await Container.git.getVersionedUri(uri); - if (versionedUri !== undefined) return versionedUri; - return new GitUri(uri, await Container.git.getRepoPath(uri)); } diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index cac058c..37a6081 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -172,9 +172,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode n instanceof RepositoryNode && n.repo.containsUri(gitUri || uri)) as + const node = this._children.find(n => n instanceof RepositoryNode && n.repo.containsUri(uri)) as | RepositoryNode | undefined; if (node === undefined) return;