Repository navigation
fix: getStatus consumes the second path of porcelain -z rename records - #572
Merged
chaitanyagiri merged 1 commit intoOct 2, 2026
Merged
Conversation
Porcelain -z emits rename/copy records with two null-terminated paths
("R <new>\0<old>\0"), but getStatus read every token as a single
"XY <path>" record, so the old path parsed as a phantom status entry
whose letters came from the filename ("alpha.txt" -> path "ha.txt",
index 'a', worktree 'l') and appeared in both the staged and unstaged
lists while the real old path was dropped; a 2-char old name was
silently skipped instead.
Parse it the way parseNameStatusZ already does: consume the source
token and keep it on the entry as oldPath (new optional field), so the
IDE panel's staged/unstaged lists no longer show files that do not
exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Git porcelain -z format encodes renames as two NUL-separated paths (old + new). The getStatus parser only consumed the first path, causing the second path to leak into subsequent entries and corrupt the status report. The fix consumes both paths for rename entries.
Type of change
Evidence
Before
After
How I tested it
node --test test/git-status-rename.test.cjsagainst unfixedmain— regression tests fail (red).npm run typecheckclean.Credit (optional)
Discord: ttawdtt
X:
Checklist
npm run typecheckpasses.npm run test:focusedpasses (except pre-existing Windows-env failures unrelated to this change, identical on clean main).npm run buildsucceeds.DESIGN.md/tokens.ts— no ad-hoc colors, spacing, or fonts.ATTRIBUTION.md.