blob: d6979d90744dbabca766a77d6f31f7a9298f0c13 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# Copyright (C) 2009, 2011-2012 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
# ==============================================================
# Starts at a line <= 1 and prefix context < suffix context: start of
# file until hunk has become symmetric.
cat > a.diff <<EOF
--- a
+++ a
@@ -1,3 +1,4 @@
2
+2a
3
4
EOF
seq 1 5 > a
check 'patch < a.diff' <<EOF
patching file a
Hunk #1 succeeded at 2 with fuzz 1 (offset 1 line).
EOF
seq 2 5 > a
check 'patch < a.diff' <<EOF
patching file a
EOF
# ==============================================================
# Starts at a line > 1: anywhere in the file
cat > a.diff <<EOF
--- a
+++ a
@@ -2,3 +2,4 @@
2
+2a
3
4
EOF
seq 1 5 > a
check 'patch < a.diff' <<EOF
patching file a
EOF
# ==============================================================
# Prefix context > suffix context: end of file until hunk has
# become symmetric.
cat > a.diff <<EOF
--- a
+++ a
@@ -2,3 +2,4 @@
2
3
+3a
4
EOF
seq 1 5 > a
check 'patch < a.diff' <<EOF
patching file a
Hunk #1 succeeded at 2 with fuzz 1.
EOF
|