diff --git a/src/git/gitUri.ts b/src/git/gitUri.ts index 9bcccf2..862e4f1 100644 --- a/src/git/gitUri.ts +++ b/src/git/gitUri.ts @@ -83,15 +83,15 @@ export class GitUri extends Uri { if (!git.isTrackable(uri)) return new GitUri(uri, git.repoPath); + // If this is a git uri, assume it is showing the most recent commit + if (uri.scheme === DocumentSchemes.Git) { + const commit = await git.getLogCommit(undefined, uri.fsPath); + if (commit !== undefined) return new GitUri(uri, commit); + } + const gitUri = git.getGitUriForFile(uri.fsPath); if (gitUri) return gitUri; - // If this is a git uri, assume it is showing the most recent commit - if (uri.scheme === DocumentSchemes.Git && uri.query === '~') { - const commit = await git.getLogCommit(undefined, uri.fsPath); - if (commit) return new GitUri(uri, commit); - } - return new GitUri(uri, (await git.getRepoPathFromFile(uri.fsPath)) || git.repoPath); } diff --git a/src/gitService.ts b/src/gitService.ts index 684a168..ff1080c 100644 --- a/src/gitService.ts +++ b/src/gitService.ts @@ -339,19 +339,6 @@ export class GitService extends Disposable { Logger.log(`Cached(${key}): getBlameForFile('${uri.repoPath}', '${uri.fsPath}', ${uri.sha})`); return cachedBlame.item; } - - if (key !== 'blame') { - // Since we are looking for partial blame, see if we have the blame of the whole file - const cachedBlame = entry.get('blame'); - if (cachedBlame !== undefined) { - Logger.log(`? Cache(${key}): getBlameForFile('${uri.repoPath}', '${uri.fsPath}', ${uri.sha})`); - const blame = await cachedBlame.item; - if (blame !== undefined && blame.commits.has(uri.sha!)) { - Logger.log(`Cached(${key}): getBlameForFile('${uri.repoPath}', '${uri.fsPath}', ${uri.sha})`); - return cachedBlame.item; - } - } - } } Logger.log(`Not Cached(${key}): getBlameForFile('${uri.repoPath}', '${uri.fsPath}', ${uri.sha})`);