Fixes issue showing repo history w/ no active editor

This commit is contained in:
Eric Amodio
2017-03-15 12:00:33 -04:00
parent 564a0b8f64
commit 2ef6c37c89
7 changed files with 57 additions and 27 deletions

View File

@@ -25,7 +25,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
maxCount = this.git.config.advanced.maxQuickHistory;
}
const progressCancellation = FileHistoryQuickPick.showProgress(maxCount);
const progressCancellation = FileHistoryQuickPick.showProgress(gitUri);
try {
if (!log) {
log = await this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath, undefined, maxCount);

View File

@@ -16,22 +16,21 @@ export class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
uri = editor && editor.document && editor.document.uri;
}
const gitUri = await GitUri.fromUri(uri, this.git);
Logger.log(`ShowQuickRepoHistoryCommand.execute`, gitUri.shortSha);
const gitUri = uri && await GitUri.fromUri(uri, this.git);
if (maxCount == null) {
maxCount = this.git.config.advanced.maxQuickHistory;
}
const progressCancellation = RepoHistoryQuickPick.showProgress(maxCount);
const progressCancellation = RepoHistoryQuickPick.showProgress();
try {
if (!log) {
const repoPath = gitUri.repoPath || await this.git.getRepoPathFromUri(uri, this.repoPath);
const repoPath = (gitUri && gitUri.repoPath) || await this.git.getRepoPathFromUri(uri, this.repoPath);
if (!repoPath) return window.showWarningMessage(`Unable to show repository history`);
if (progressCancellation.token.isCancellationRequested) return undefined;
log = await this.git.getLogForRepo(repoPath, gitUri.sha, maxCount);
log = await this.git.getLogForRepo(repoPath, (gitUri && gitUri.sha), maxCount);
if (!log) return window.showWarningMessage(`Unable to show repository history`);
}