codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix(sync): filter git-status fast path through ignore matcher

Open itxaiohanglover opened this issue 5 months ago • 0 comments

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 .ts file inside node_modules/, modifies it, and verifies sync() does not index it (filesAdded: 0, filesModified: 0).
  • All 15 existing + new sync tests pass.
  • tsc --noEmit clean.

itxaiohanglover avatar Jun 18 '26 11:06 itxaiohanglover