Skip to content

parser: recognize additions with named file headers#80

Merged
shannonbooth merged 2 commits into
mainfrom
regression-prompt-name
Jul 20, 2026
Merged

parser: recognize additions with named file headers#80
shannonbooth merged 2 commits into
mainfrom
regression-prompt-name

Conversation

@shannonbooth

Copy link
Copy Markdown
Owner

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

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.
@starseeker

Copy link
Copy Markdown
Contributor

Nice, thanks! I'll try to test later today

@shannonbooth
shannonbooth merged commit 15358ea into main Jul 20, 2026
9 checks passed
@starseeker

Copy link
Copy Markdown
Contributor

@shannonbooth Looks like that's working - thanks!

@shannonbooth

Copy link
Copy Markdown
Owner Author

Great! Sorry about that regression

@starseeker

starseeker commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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.

@shannonbooth

shannonbooth commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

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

@shannonbooth

Copy link
Copy Markdown
Owner Author

*feature request to be clear 😅 even for things not in other patch programs happy to look at

@shannonbooth
shannonbooth deleted the regression-prompt-name branch July 21, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants