mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-01 01:25:44 -05:00
Adds ability to suppress most warning messages
This commit is contained in:
@@ -5,6 +5,7 @@ import { GitCommit, GitLogCommit, GitService, GitUri, IGitLog } from '../gitServ
|
||||
import { Logger } from '../logger';
|
||||
import { CommandQuickPickItem, CommitFileDetailsQuickPick } from '../quickPicks';
|
||||
import { ShowQuickCommitDetailsCommandArgs } from './showQuickCommitDetails';
|
||||
import { Messages } from '../messages';
|
||||
import * as path from 'path';
|
||||
|
||||
export interface ShowQuickCommitFileDetailsCommandArgs {
|
||||
@@ -37,9 +38,12 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
|
||||
|
||||
try {
|
||||
const blame = await this.git.getBlameForLine(gitUri, blameline);
|
||||
if (blame === undefined) return window.showWarningMessage(`Unable to show commit file details. File is probably not under source control`);
|
||||
if (blame === undefined) return Messages.showFileNotUnderSourceControlWarningMessage('Unable to show commit file details');
|
||||
|
||||
args.sha = blame.commit.isUncommitted ? blame.commit.previousSha : blame.commit.sha;
|
||||
// Because the previous sha of an uncommitted file isn't trust worthy we just have to kick out
|
||||
if (blame.commit.isUncommitted) return Messages.showLineUncommittedWarningMessage('Unable to show commit file details');
|
||||
|
||||
args.sha = blame.commit.sha;
|
||||
|
||||
args.commit = blame.commit;
|
||||
workingFileName = path.relative(args.commit.repoPath, gitUri.fsPath);
|
||||
@@ -65,12 +69,12 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
|
||||
}
|
||||
|
||||
if (args.fileLog === undefined) {
|
||||
args.commit = await this.git.getLogCommit(args.commit ? args.commit.repoPath : gitUri.repoPath, gitUri.fsPath, args.sha, { previous: true });
|
||||
if (args.commit === undefined) return window.showWarningMessage(`Unable to show commit file details`);
|
||||
args.commit = await this.git.getLogCommit(args.commit === undefined ? gitUri.repoPath : args.commit.repoPath, gitUri.fsPath, args.sha, { previous: true });
|
||||
if (args.commit === undefined) return Messages.showCommitNotFoundWarningMessage(`Unable to show commit file details`);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.commit === undefined) return window.showWarningMessage(`Unable to show commit file details`);
|
||||
if (args.commit === undefined) return Messages.showCommitNotFoundWarningMessage(`Unable to show commit file details`);
|
||||
|
||||
// Attempt to the most recent commit -- so that we can find the real working filename if there was a rename
|
||||
args.commit.workingFileName = workingFileName;
|
||||
|
||||
Reference in New Issue
Block a user