Skip to content

Commit f1042de

Browse files
committed
Stops some code lens actions when uncommitted
1 parent efd3d40 commit f1042de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/gitCodeLensProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
360360
}
361361

362362
_applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines, commit?: GitCommit): T {
363-
if (!commit) {
363+
if (commit === undefined) {
364364
const blameLine = blame.allLines[lens.range.start.line];
365365
commit = blame.commits.get(blameLine.sha);
366366
}
@@ -382,7 +382,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
382382
_applyShowQuickCommitDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines, commit?: GitCommit): T {
383383
lens.command = {
384384
title: title,
385-
command: CodeLensCommand.ShowQuickCommitDetails,
385+
command: commit !== undefined && commit.isUncommitted ? '' : CodeLensCommand.ShowQuickCommitDetails,
386386
arguments: [
387387
Uri.file(lens.uri.fsPath),
388388
{
@@ -396,7 +396,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
396396
_applyShowQuickCommitFileDetailsCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines, commit?: GitCommit): T {
397397
lens.command = {
398398
title: title,
399-
command: CodeLensCommand.ShowQuickCommitFileDetails,
399+
command: commit !== undefined && commit.isUncommitted ? '' : CodeLensCommand.ShowQuickCommitFileDetails,
400400
arguments: [
401401
Uri.file(lens.uri.fsPath),
402402
{

0 commit comments

Comments
 (0)