@@ -56,30 +56,20 @@ export interface MultiIndexRunnerConfig {
5656export async function createSourceFromState ( state : IndexStateSearchOnly ) : Promise < Source > {
5757 const meta = state . source ;
5858
59- // Helper to get the ref for VCS sources.
60- // Uses resolvedRef (indexed commit SHA) to ensure file operations match search results.
59+ // For VCS sources, use resolvedRef (indexed commit SHA) if available.
60+ // This ensures file operations (listFiles, readFile) return content from
61+ // the same commit that was indexed, so results match search.
6162 // Falls back to config.ref for backwards compatibility with older indexes.
62- const getRef = ( configRef : string | undefined , resolvedRef : string | undefined ) =>
63- resolvedRef ?? configRef ;
6463
6564 if ( meta . type === "github" ) {
6665 const { GitHubSource } = await import ( "../sources/github.js" ) ;
67- return new GitHubSource ( {
68- ...meta . config ,
69- ref : getRef ( meta . config . ref , meta . resolvedRef ) ,
70- } ) ;
66+ return new GitHubSource ( { ...meta . config , ref : meta . resolvedRef ?? meta . config . ref } ) ;
7167 } else if ( meta . type === "gitlab" ) {
7268 const { GitLabSource } = await import ( "../sources/gitlab.js" ) ;
73- return new GitLabSource ( {
74- ...meta . config ,
75- ref : getRef ( meta . config . ref , meta . resolvedRef ) ,
76- } ) ;
69+ return new GitLabSource ( { ...meta . config , ref : meta . resolvedRef ?? meta . config . ref } ) ;
7770 } else if ( meta . type === "bitbucket" ) {
7871 const { BitBucketSource } = await import ( "../sources/bitbucket.js" ) ;
79- return new BitBucketSource ( {
80- ...meta . config ,
81- ref : getRef ( meta . config . ref , meta . resolvedRef ) ,
82- } ) ;
72+ return new BitBucketSource ( { ...meta . config , ref : meta . resolvedRef ?? meta . config . ref } ) ;
8373 } else if ( meta . type === "website" ) {
8474 const { WebsiteSource } = await import ( "../sources/website.js" ) ;
8575 return new WebsiteSource ( meta . config ) ;
0 commit comments