Skip to content

Commit ea56ff0

Browse files
authored
patch: runtime error when patching the wrong file (#703)
* patch failed with a strictness error when I specified a file * Patch::apply() calls back into Patch::Context::apply() on L714 with the wrong params * When setting a breakpoint in Patch::apply(), its params are not identical to Patch::Context::apply(), so passing @_ as parameter fails * Reading the code, this would only be a problem for applying context diffs (no callback to self->apply() happened for the other diff types) * I confirmed that this error was not caused by the recent use-base.diff (now I suspect it goes back to 1999) * Removing the code with the incorrect self->apply() call causes patch to correctly report that applying Hunk #1 failed, then the program exits with status 1 to indicate that >=1 lines could not be applied
1 parent d88fa19 commit ea56ff0

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

bin/patch

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ License: perl
1818

1919
use strict;
2020

21-
my $VERSION = '0.27';
21+
my $VERSION = '0.28';
2222

2323
$|++;
2424

@@ -706,13 +706,6 @@ sub apply {
706706
} else {
707707
throw('SKIP...ignore this patch') if $self->{forward};
708708
}
709-
} else {
710-
unless ($position || $self->{reverse} || $self->{force}) {
711-
$self->{reverse_check} = 1;
712-
$self->{reverse} = 1;
713-
shift;
714-
return $self->apply(@_);
715-
}
716709
}
717710
}
718711
$position or throw("Couldn't find anywhere to put hunk.\n");

0 commit comments

Comments
 (0)