codegraph
codegraph copied to clipboard
fix(sync): filter git-status fast path through ignore matcher
What
Fixes #766
The incremental sync's git fast path consumed git status --porcelain output without filtering through buildDefaultIgnore, so tracked files in default-ignored dirs (node_modules/, vendor/, etc.) leaked back into the index on every sync — disagreeing with a full index --force.
The fix
Build the shared buildDefaultIgnore(this.rootDir) matcher once and continue past ignored paths in the modified+added loop. Deleted files stay unfiltered — removal is always correct for stale entries, and it lets a newly-excluded dir's old entries clean up.
Same approach suggested by @monochrome3694 in the issue, verified locally on a ~1,100-file workspace.
Testing
- Added regression test: commits a
.tsfile insidenode_modules/, modifies it, and verifiessync()does not index it (filesAdded: 0, filesModified: 0). - All 15 existing + new sync tests pass.
tsc --noEmitclean.