parser: recognize additions with named file headers#80
Conversation
Commit fcf718f stopped inferring additions from empty old ranges when file headers were present. As a result, patches creating files without a /dev/null header were classified as changes, leaving the nonexistent destination unselected and causing patch to prompt for a file. Restore addition inference for zero-start old ranges while retaining the rule that an empty new range with named headers only empties the file rather than deleting it.
When no target file could be selected, process_patch always prompted through /dev/tty, even when --force or --batch was specified.
|
Nice, thanks! I'll try to test later today |
|
@shannonbooth Looks like that's working - thanks! |
|
Great! Sorry about that regression |
|
No worries. Our bext repository does a lot of patching, but due to the uniformity of our patch format there's actually a lot of code paths in your patch we don't exercise much - we've actually been trying to switch to copying files in or removing them explicitly rather than making patch handle that case, but it looks like I missed one. Oh well, a useful test case. |
If there is something which would make your life easier or a bug you've seen feel free to make an issue or feature request and I'll take a look! But indeed, one thing I have learnt from working on this is that there is a surprising amount of variations in patch/diff formats w/ no standardisation around it |
|
*feature request to be clear 😅 even for things not in other patch programs happy to look at |
Commit fcf718f stopped inferring additions from empty old ranges when file headers were present. As a result, patches creating files without a /dev/null header were classified as changes, leaving the nonexistent destination unselected and causing patch to prompt for a file.
Restore addition inference for zero-start old ranges while retaining the rule that an empty new range with named headers only empties the file rather than deleting it.
cc @starseeker, I suspect this might be the cause of the issue you mentioned