mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-17 01:35:37 -05:00
Reduces git calls on known untrackables
This commit is contained in:
@@ -72,17 +72,19 @@ export class GitUri extends Uri {
|
||||
}
|
||||
|
||||
getRelativePath(): string {
|
||||
return GitService.normalizePath(path.relative(this.repoPath || '', this.fsPath));
|
||||
return GitService.normalizePath(path.relative(this.repoPath || '', this.fsPath));
|
||||
}
|
||||
|
||||
static async fromUri(uri: Uri, git: GitService) {
|
||||
if (uri instanceof GitUri) return uri;
|
||||
|
||||
if (!git.isTrackable(uri)) return new GitUri(uri, git.repoPath);
|
||||
|
||||
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 === 'git' && uri.query === '~') {
|
||||
if (uri.scheme === DocumentSchemes.Git && uri.query === '~') {
|
||||
const commit = await git.getLogCommit(undefined, uri.fsPath);
|
||||
if (commit) return new GitUri(uri, commit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user