FA-75755 / Text diff and three-way merge / Member archive
Unified hunk parser: no-newline markers end the hunk body · case 05
Patches touching a last line without newline are reported as truncated.
Case contract
Parse "@@ -a[,b] +c[,d] @@" hunks (omitted counts are 1) and consume body lines until both remaining counts reach zero: " " (or a completely empty line) counts for both sides, "-" for old, "+" for new, "\\" marker lines are skipped and not counted, anything else ends the body. Remaining counts other than zero yield {"error": "hunk k truncated"}. Return [a, b, c, d, body_lines] per hunk.
Why this case matters
Patch tools must validate hunk bodies against their headers before applying anything.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| no-newline marker is not a body line | {"error": "hunk 0 truncated"} | {"hunks": [[1, 1, 1, 1, 2]]} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗