Re:The Art of Manually Editing Hunks
by rapidlua on Wednesday November 13, 2024 @03:15PM
(#42129486)
I do occasionally attempt to edit patch files produced by git-format-patch. Frequently I end up with corrupt patch. Still curious how to fix those numbers.
[ Parent
| on HN ]
Re:The Art of Manually Editing Hunks
by mananaysiempre on Wednesday November 13, 2024 @03:29PM
(#42129636)
With git format-patch Iād say take a worktree, git apply the patch to its intended base, commit, rebase, and git format-patch again :)
Otherwise, well, the numbers are -(old start line number),(old line count) +(new start line number),(new line count) for the entire hunk introduced by @@ (whether it contains one group of changed lines or more). I'm sure you see how to fix them up, but accumulating a line number shift as you go through the file sounds very fiddly and error-prone. It also sounds like something the computer should be able to do for you (given the old patch and the new messed-up patch whose hunks correspond one-to-one to the old).