Repository navigation
Patch() parser has no fixture for a hunkless rename or a mode-only change, so the design's "headers and no hunks" behaviour is unasserted #186
Description
What's missing
The patch-verbs design commits to two parser behaviours that no test pins down:
Plan:
GitIntegration/docs/superpowers/specs/2026-09-24-patch-verbs-design.md
Lines 170 to 182 in 647dbbc
| **Renames and mode changes.** Both produce a file entry with headers and no hunks. Nothing special is | |
| needed beyond not assuming every file has them. | |
| **Untracked files.** They never appear in a patch, because `git diff` does not show them. Staging one | |
| is `Add`, and a caller building a staging view has to know that its file list comes from `Status` and | |
| its hunks come from `Patch`, which are different sources that disagree about untracked content. | |
| ## Testing | |
| Parser tests run against fixtures captured from a real git, following this repository's existing | |
| practice of capturing output once and treating it as fixed rather than re-deriving it. Fixtures | |
| cover: a modification with two hunks, a file with no trailing newline, a rename with no hunks, a | |
| binary file, a combined conflict hunk, and content with CRLF line endings. |
Renames and mode changes. Both produce a file entry with headers and no hunks. Nothing special is needed beyond not assuming every file has them.
Fixtures cover: a modification with two hunks, a file with no trailing newline, a rename with no hunks, a binary file, a combined conflict hunk, and content with CRLF line endings.
What exists today
GitIntegration.Test/Fixtures/haspatch-rename-modified.txt(a rename with hunks) andpatch-quoted-rename.txt, but no pure (100% similarity) rename fixture and noold mode/new modefixture.GitPatchRoundTripTests.ReportsAStagedRenameAsDeleteAndAddUnlessRequestedAsyncchecks the kind andOriginalPathof a pure rename, but never assertsHunksis empty, nor whatHeaderkeeps.GitIntegration/Parsing/GitPatchParser.csrecognisesrename from/rename to,new file modeanddeleted file mode, but has no explicit handling or test forold mode/new modeheader lines (achmod +xwith no content change).
Why it matters
A mode-only change and a pure rename are the two ordinary cases where a file entry has no @@ lines. If a later parser change starts assuming each file has a hunk (or swallows the next file's diff --git line as header), a staging UI built on Patch() would lose or mis-attribute the file, and nothing in the suite would fail.
Acceptance criteria
- Fixtures captured from a real git:
patch-rename-pure.txt(git mvwith no edit,-M) andpatch-mode-change.txt(chmod +xonly), each followed by at least one further ordinary file in the same output. - Pure rename parses as
Renamed,OriginalPathset,Hunksempty,Headerretains thesimilarity index/rename from/rename tolines. - Mode-only change parses as a single
Modifiedentry,Hunksempty,old mode/new modekept inHeader. - Neither entry is flagged
IsBinaryor conflicted, and the following file still parses with its hunks.
Dependencies
None. Related to #126 (rename headers in PatchFor), but not blocked by it.
Activity
matt-edmondson commentedon Oct 7, 2026
Triage
GitIntegration.Test/Fixtures/and theGitPatchParsertests. The issue also flags thatold mode/new modehas no explicit handling, so check that first.Generated by Claude Code