codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix(extraction): handle non-ASCII paths in git fast paths

Open thismilktea opened this issue 6 months ago • 1 comments

Summary

  • switch git-backed file discovery to -z / NUL-delimited parsing
  • switch git-backed change detection to git status --porcelain -z
  • add regression coverage for CJK directory names in both discovery and sync paths

Problem

Files under non-ASCII directory names could be silently skipped during indexing because git fast paths were parsing human-readable text output rather than machine-readable path output.

When Git returned quoted/escaped non-ASCII paths, CodeGraph could treat that display-format output as a literal file path and skip the file before it ever reached extraction.

Fix

This PR updates the git-backed scan/change-detection paths in src/extraction/index.ts to use -z machine-readable output and parse NUL-delimited records instead of newline-delimited text output.

That avoids Git quoted/escaped path output from being treated as a literal path, which restores correct handling for files under CJK and other non-ASCII directory names.

Test plan

  • npx vitest run __tests__/extraction.test.ts -t "issue #541"
  • npx vitest run __tests__/sync.test.ts -t "CJK directories via git"
  • npm run build

Close #541

thismilktea avatar May 29 '26 09:05 thismilktea

Thanks for this — closing as superseded. Non-ASCII/CJK git paths are now handled on main via git ls-files -z (NUL-separated, unquoted output — robust for any path bytes), and #541 is closed. Your fix targeted the same issue; it just landed a different way. Appreciate you catching it.

colbymchenry avatar Jun 08 '26 05:06 colbymchenry