summaryrefslogtreecommitdiff
path: root/tests/dash-o-append
blob: cc2bcbf8ea529e5f243ad4aa8e861f2c51a2d10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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

# ==============================================================

# IEEE Std 1003.1-2008 requires that with -o outfile, multiple patches
# for a single file shall be applied to the intermediate versions of the
# file created by any previous patches, and shall result in multiple,
# concatenated versions of the file being written to outfile.

cat > a.diff <<EOF
--- a
+++ a
@@ -1 +1 @@
-one
+two
--- a
+++ a
@@ -1 +1 @@
-two
+three
EOF

echo one > a

check 'patch -o a.new a < a.diff' <<EOF
patching file a
patching file a
EOF

check 'cat a.new' <<EOF
two
three
EOF