perf(#311): index subrepo routing by first path segment (#390)

cmdCommitToSubrepo routed each changed file to a sub-repo via
subRepos.find(...) inside the file loop — O(files * repos). Extract a pure
groupFilesBySubrepo() that buckets sub-repos by first path segment and scans
only the matching bucket, dropping it to expected O(files + repos). First-
match-in-array-order semantics (incl. multi-segment sub-repos) are preserved
exactly. Adds the first behavior-lock test for the routing path.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-05-27 20:21:29 -04:00
committed by GitHub
parent 09123e395e
commit 25d24219bf
3 changed files with 114 additions and 11 deletions

View File

@@ -0,0 +1,5 @@
---
type: Fixed
pr: 311
---
Route changed files to sub-repos via a first-segment bucket index instead of an O(files*repos) linear scan (#311).