Skip to content

Commit

Permalink
Fixes commit search from repos in the view
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Jul 11, 2019
1 parent 27ab08c commit 325324a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/commands/searchCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface SearchCommitsCommandArgs {
search?: string;
searchBy?: GitRepoSearchBy;
prefillOnly?: boolean;
repoPath?: string;
showInView?: boolean;

goBackCommand?: CommandQuickPickItem;
Expand All @@ -63,6 +64,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
}

if (isCommandViewContextWithRepo(context)) {
args.repoPath = context.node.repo.path;
return this.execute(context.editor, context.node.uri, args);
}
}
Expand All @@ -80,7 +82,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
async execute(editor?: TextEditor, uri?: Uri, args: SearchCommitsCommandArgs = {}) {
uri = getCommandUri(uri, editor);

const repoPath = await getRepoPathOrPrompt(
const repoPath = args.repoPath || await getRepoPathOrPrompt(
`Search for commits in which repository${GlyphChars.Ellipsis}`,
args.goBackCommand
);
Expand Down Expand Up @@ -110,11 +112,12 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
await Container.searchView.show();
}

const repo = await Container.git.getRepository(repoPath);

const opts: InputBoxOptions = {
value: args.search,
prompt: 'Please enter a search string',
placeHolder:
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)',
placeHolder: `Search${repo === undefined ? '' : ` ${repo.formattedName}`} for commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)`,
valueSelection: selection
};
args.search = await window.showInputBox(opts);
Expand Down

0 comments on commit 325324a

Please sign in to comment.