Skip to content

Commit a8c26dc

Browse files
fix(worker): Fixed issue where searching for refs/heads/<default_branch> would return no matches. (#809)
1 parent 9d8dcb3 commit a8c26dc

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- Fixed issue where searching for refs/heads/<default_branch> would return no matches. [#809](https://github.com/sourcebot-dev/sourcebot/pull/809)
12+
1013
## [4.10.19] - 2026-01-28
1114

1215
### Fixed

packages/backend/src/repoIndexManager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,12 @@ export class RepoIndexManager {
397397
path: repoPath,
398398
});
399399

400-
let revisions = defaultBranch ? [defaultBranch] : ['HEAD'];
400+
// Ensure defaultBranch has refs/heads/ prefix for consistent searching
401+
const defaultBranchWithPrefix = defaultBranch && !defaultBranch.startsWith('refs/')
402+
? `refs/heads/${defaultBranch}`
403+
: defaultBranch;
404+
405+
let revisions = defaultBranchWithPrefix ? [defaultBranchWithPrefix] : ['HEAD'];
401406

402407
if (metadata.branches) {
403408
const branchGlobs = metadata.branches
@@ -427,6 +432,9 @@ export class RepoIndexManager {
427432
];
428433
}
429434

435+
// De-duplicate revisions to ensure we don't have duplicate branches/tags
436+
revisions = [...new Set(revisions)];
437+
430438
// zoekt has a limit of 64 branches/tags to index.
431439
if (revisions.length > 64) {
432440
logger.warn(`Too many revisions (${revisions.length}) for repo ${repo.id}, truncating to 64`);

0 commit comments

Comments
 (0)