mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 01:25:42 -05:00
Consolidates certain getLogForFile usage patterns into getLogCommit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
import { Iterables } from './system';
|
||||
// import { Iterables } from './system';
|
||||
import { CancellationToken, CodeLens, CodeLensProvider, DocumentSelector, ExtensionContext, Range, TextDocument, Uri } from 'vscode';
|
||||
import { Commands } from './commands';
|
||||
import { DocumentSchemes } from './constants';
|
||||
@@ -31,10 +31,7 @@ export class GitRevisionCodeLensProvider implements CodeLensProvider {
|
||||
|
||||
const lenses: CodeLens[] = [];
|
||||
|
||||
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, gitUri.sha, undefined, 2);
|
||||
if (!log) return lenses;
|
||||
|
||||
const commit = (gitUri.sha && log.commits.get(gitUri.sha)) || Iterables.first(log.commits.values());
|
||||
const commit = await this.git.getLogCommit(gitUri.repoPath, gitUri.fsPath, gitUri.sha, { firstIfMissing: true, previous: true });
|
||||
if (!commit) return lenses;
|
||||
|
||||
lenses.push(new GitDiffWithWorkingCodeLens(this.git, commit.uri.fsPath, commit, new Range(0, 0, 0, 1)));
|
||||
|
||||
Reference in New Issue
Block a user