Skip to content

Commit 8f6c5db

Browse files
Add rev:* syntax to explicitly search all branches
1 parent 1507364 commit 8f6c5db

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/web/src/lib/server/searchService.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ const transformZoektQuery = async (query: string, orgId: number): Promise<string
4141
// Handle mapping `rev:` and `revision:` to `branch:`
4242
if (part.match(/^-?(rev|revision):.+$/)) {
4343
const isNegated = part.startsWith("-");
44-
const revisionName = part.slice(part.indexOf(":") + 1);
44+
let revisionName = part.slice(part.indexOf(":") + 1);
45+
46+
// Special case: `*` -> search all revisions.
47+
// In zoekt, providing a blank string will match all branches.
48+
// @see: https://github.com/sourcebot-dev/zoekt/blob/main/eval.go#L560-L562
49+
if (revisionName === "*") {
50+
revisionName = "";
51+
}
4552
newQueryParts.push(`${isNegated ? "-" : ""}${zoektPrefixes.branch}${revisionName}`);
4653
}
4754

0 commit comments

Comments
 (0)