File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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` ) ;
You can’t perform that action at this time.
0 commit comments