diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-03-14 16:24:09 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2009-03-22 13:39:09 +0100 |
commit | b80bfda68fe5f01f5163fa4877f45dd4334c6abb (patch) | |
tree | 08c883573b9c8dfc97285c17a39c542a89eae120 /tests/global-reject-files | |
parent | 9371e1ac99004384dc410ceb0757761578e259c1 (diff) | |
download | patch-b80bfda68fe5f01f5163fa4877f45dd4334c6abb.tar.gz |
Make "patch -r rejfile" work even when there are several rejects
With a patch that includes rejects in more than one file and with the -r
option, rejects would overwrite themselves and only the rejects from
the last file would remain. Fix this.
Diffstat (limited to 'tests/global-reject-files')
-rwxr-xr-x | tests/global-reject-files | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/global-reject-files b/tests/global-reject-files new file mode 100755 index 0000000..be06bec --- /dev/null +++ b/tests/global-reject-files @@ -0,0 +1,90 @@ +#! /bin/bash + +# Copyright (C) 2009 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# in any medium, are permitted without royalty provided the copyright +# notice and this notice are preserved. + +# More than one reject to + +. $srcdir/test-lib.sh + +require_cat +require_diff +use_local_patch +use_tmpdir + +# ============================================================== + +cat > ab.diff <<EOF +--- a ++++ a +@@ -1 +1 @@ +-one ++two +--- b ++++ b +@@ -1 +1 @@ +-three ++four +EOF + +echo one > a +echo three > b + +check 'patch -p0 < ab.diff' <<EOF +patching file a +patching file b +EOF + +# ============================================================== + +check 'patch -p0 -f < ab.diff || echo "Status: $?"' <<EOF +patching file a +Hunk #1 FAILED at 1. +1 out of 1 hunk FAILED -- saving rejects to file a.rej +patching file b +Hunk #1 FAILED at 1. +1 out of 1 hunk FAILED -- saving rejects to file b.rej +Status: 1 +EOF + +check 'cat a.rej' <<EOF +--- a ++++ a +@@ -1 +1 @@ +-one ++two +EOF + +check 'cat b.rej' <<EOF +--- b ++++ b +@@ -1 +1 @@ +-three ++four +EOF + +check 'patch -p0 -f -r ab.rej < ab.diff || echo "Status: $?"' <<EOF +patching file a +Hunk #1 FAILED at 1. +1 out of 1 hunk FAILED -- saving rejects to file ab.rej +patching file b +Hunk #1 FAILED at 1. +1 out of 1 hunk FAILED -- saving rejects to file ab.rej +Status: 1 +EOF + +check 'cat ab.rej' <<EOF +--- a ++++ a +@@ -1 +1 @@ +-one ++two +--- b ++++ b +@@ -1 +1 @@ +-three ++four +EOF |