You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
analyzeGitDelta: renamed and copied files lose isBinary (numstat -z parsed in the wrong format) #175
Every renamed or copied file gets isBinary: undefined, binary or not.
Cause
analyzeGitDelta runs git diff-tree -r --numstat -z --find-renames=50%. With -z, git writes a rename as three NUL-separated fields, added\tdeleted\t (empty path), then the old path, then the new path:
0000000 0 \t 0 \t \0 a . t x t \0 c . t x t \0
0000020 - \t - \t \0 b . b i n \0 d . b i n \0
parseNumstat (src/git/git-diff.ts:151-178) splits on NUL and parses each piece as one record. It expects the tab-separated added\tdeleted\told\tnew form, which git never writes with -z. So the rename header has an empty path and is dropped, and the two path pieces have no tabs and are dropped too. The unit test "handles rename numstat records" (tests/git/git-diff.parsers.test.ts:83) builds that non-git form, so it passes.
The same split also misreads a non-rename path that contains a tab, which -z leaves unquoted. Its last tab-separated piece is taken as the path.
Nothing in core or the CLI reads isBinary today, so this is limited to the GitDelta that analyzeGitDelta returns and serializes. The field is documented on ChangedFile but is wrong for every rename or copy.
What you expected
isBinary is true for d.bin and false for c.txt, and the parser test uses the byte format git diff-tree --numstat -z actually produces.
Activity
fix(git-diff): parse numstat -z renames so renamed files keep isBinary (