diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-03-27 23:05:40 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2009-03-28 16:50:09 +0100 |
commit | 8a3f4d70e4093a649574cc7705161b36184ce898 (patch) | |
tree | d32f071467b6eb0778304b81014165182acb5a51 /tests/backup-prefix-suffix | |
parent | 19947785bf0837edceacfce3fa643fa6e28fcd84 (diff) | |
download | patch-8a3f4d70e4093a649574cc7705161b36184ce898.tar.gz |
Enforce simple backup mode and compute the backup file name if -B, -Y, or -z is used
This fixes the case where -B or -Y is combined with -z (bug 25968).
Diffstat (limited to 'tests/backup-prefix-suffix')
-rw-r--r-- | tests/backup-prefix-suffix | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/backup-prefix-suffix b/tests/backup-prefix-suffix new file mode 100644 index 0000000..27eab5b --- /dev/null +++ b/tests/backup-prefix-suffix @@ -0,0 +1,88 @@ +# 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. + +. $srcdir/test-lib.sh + +require_cat +use_local_patch +use_tmpdir + +# ============================================================== + +cat > ab.diff <<EOF +--- a/f ++++ b/f +@@ -1 +1 @@ +-one ++two +EOF + +echo one > f +check 'patch -b -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat f.orig' <<EOF +one +EOF + +echo one > f +check 'patch -b -B prefix. -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat prefix.f' <<EOF +one +EOF + +echo one > f +check 'patch -b -z .suffix -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat f.suffix' <<EOF +one +EOF + +echo one > f +check 'patch -b -B prefix. -z .suffix -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat prefix.f.suffix' <<EOF +one +EOF + +export PATCH_VERSION_CONTROL=existing +export SIMPLE_BACKUP_SUFFIX=.bak +echo one > f +check 'patch -b -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat f.bak' <<EOF +one +EOF + +touch f.~1~ +echo one > f +check 'patch -b -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat f.~2~' <<EOF +one +EOF + +export PATCH_VERSION_CONTROL=numbered +echo one > f +check 'patch -b -p1 < ab.diff' <<EOF +patching file f +EOF + +check 'cat f.~3~' <<EOF +one +EOF |