Share a source index across each pipeline run

This commit is contained in:
2026-11-26 01:34:51 +00:00
parent 4b03a439cb
commit 6345727601
10 changed files with 127 additions and 13 deletions

View File

@@ -18,6 +18,15 @@ func NewSourceRefOrder(doc *source.SourceDocument) SourceRefOrder {
return NewSourceRefOrderFromIndex(source.NewDocumentIndex(doc))
}
// NewSourceRefOrderForSource uses a borrowed whole-source index when provided.
// The caller must supply an index for doc; otherwise one is built locally.
func NewSourceRefOrderForSource(doc *source.SourceDocument, index *source.DocumentIndex) SourceRefOrder {
if index != nil {
return NewSourceRefOrderFromIndex(*index)
}
return NewSourceRefOrder(doc)
}
// NewSourceRefOrderFromIndex captures source identity and unit positions from
// one document index for source-reference comparison and canonicalization.
func NewSourceRefOrderFromIndex(index source.DocumentIndex) SourceRefOrder {