Skip to content

Commit 325324a

Browse files
committed
Fixes commit search from repos in the view
1 parent 27ab08c commit 325324a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/commands/searchCommits.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface SearchCommitsCommandArgs {
3838
search?: string;
3939
searchBy?: GitRepoSearchBy;
4040
prefillOnly?: boolean;
41+
repoPath?: string;
4142
showInView?: boolean;
4243

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

6566
if (isCommandViewContextWithRepo(context)) {
67+
args.repoPath = context.node.repo.path;
6668
return this.execute(context.editor, context.node.uri, args);
6769
}
6870
}
@@ -80,7 +82,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
8082
async execute(editor?: TextEditor, uri?: Uri, args: SearchCommitsCommandArgs = {}) {
8183
uri = getCommandUri(uri, editor);
8284

83-
const repoPath = await getRepoPathOrPrompt(
85+
const repoPath = args.repoPath || await getRepoPathOrPrompt(
8486
`Search for commits in which repository${GlyphChars.Ellipsis}`,
8587
args.goBackCommand
8688
);
@@ -110,11 +112,12 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {
110112
await Container.searchView.show();
111113
}
112114

115+
const repo = await Container.git.getRepository(repoPath);
116+
113117
const opts: InputBoxOptions = {
114118
value: args.search,
115119
prompt: 'Please enter a search string',
116-
placeHolder:
117-
'Search commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)',
120+
placeHolder: `Search${repo === undefined ? '' : ` ${repo.formattedName}`} for commits by message, author (@<pattern>), files (:<path/glob>), commit id (#<sha>), or changes (~<pattern>)`,
118121
valueSelection: selection
119122
};
120123
args.search = await window.showInputBox(opts);

0 commit comments

Comments
 (0)