Skip to content

Commit 7025f19

Browse files
authored
patch: fix reversed patch check
When applying the same patch twice I noticed there was no message about a reversed patch being detected. Then when I looked at the code, flag reverse_check was never being set. Restore the missing else-block from an older commit which sets reverse_check. It was likely deleted by mistake.
1 parent a3d72a2 commit 7025f19

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/patch

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use constant EX_SUCCESS => 0;
2424
use constant EX_REJECTS => 1;
2525
use constant EX_FAILURE => 2;
2626

27-
my $VERSION = '0.35';
27+
my $VERSION = '0.36';
2828

2929
$|++;
3030

@@ -764,6 +764,13 @@ sub apply {
764764
} else {
765765
$self->throw('SKIP...ignore this patch') if $self->{forward};
766766
}
767+
} else {
768+
unless ($position || $self->{reverse} || $self->{force}) {
769+
$self->{reverse_check} = 1;
770+
$self->{reverse} = 1;
771+
shift;
772+
return $self->apply(@_);
773+
}
767774
}
768775
}
769776
$position or $self->throw("Couldn't find anywhere to put hunk.\n");

0 commit comments

Comments
 (0)