Skip to content

Commit 313031b

Browse files
authored
patch: don't reject final hunk in context diff
* If EOF is seen, process all hunks seen and terminate * I was debugging why a "short hunk ignored" error occurred for the last hunk in a 2-hunk diff * undef was being matched against valid-diff-line regex, but undef means there are no more lines in the diff to process
1 parent d64b9ce commit 313031b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bin/patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ while (<PATCH>) {
185185
print PATCH;
186186
for ($o_start..$o_end) {
187187
$_ = <PATCH>;
188+
last unless defined $_; # EOF: no further hunks
188189
unless (s/$re/$1/) {
189190
$patch->note("Short hunk ignored.\n");
190191
$patch->reject($i_range, @i_hunk, $o_range, @o_hunk);

0 commit comments

Comments
 (0)