From 3aab904aaf853beeb0dfb0166d2eea94fd0c5e49 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 9 Apr 2017 01:17:32 -0400 Subject: [PATCH] Fixes go back support --- src/commands/showCommitSearch.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/commands/showCommitSearch.ts b/src/commands/showCommitSearch.ts index 3645dac..73d63f5 100644 --- a/src/commands/showCommitSearch.ts +++ b/src/commands/showCommitSearch.ts @@ -25,7 +25,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand { prompt: `Please enter a search string`, placeHolder: `search by message, author (use a:), files (use f:), or sha (use s:)` } as InputBoxOptions); - if (!search) return undefined; + if (search === undefined) return goBackCommand && goBackCommand.execute(); if (Git.isSha(search)) { searchBy = 'sha'; @@ -71,15 +71,13 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand { break; } - if (!goBackCommand) { - // Create a command to get back to the branch history - goBackCommand = new CommandQuickPickItem({ - label: `go back \u21A9`, - description: `\u00a0 \u2014 \u00a0\u00a0 to commit search` - }, Commands.ShowCommitSearch, [gitUri, originalSearch]); - } + // Create a command to get back to here + const currentCommand = new CommandQuickPickItem({ + label: `go back \u21A9`, + description: `\u00a0 \u2014 \u00a0\u00a0 to commit search` + }, Commands.ShowCommitSearch, [gitUri, originalSearch, undefined, goBackCommand]); - const pick = await CommitsQuickPick.show(this.git, log, placeHolder, goBackCommand); + const pick = await CommitsQuickPick.show(this.git, log, placeHolder, currentCommand); if (!pick) return undefined; if (pick instanceof CommandQuickPickItem) {