@matheusbsbs / matheus-bagliano / commits / c24e9757e9
Fork 0

t4119: add test for traditional patch and different p_value

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 21, 2007 at 01:14 UTC c24e9757e9f608ad3985ee9093d28ca5cd37f052
1 file changed +49 -2
t/t4119-apply-config.sh
+49 -2
@@ -18,6 +18,15 @@ test_expect_success setup '
18 git diff >patch.file
19 '
20
21 +# Also handcraft GNU diff output; note this has trailing whitespace.
22 +cat >gpatch.file <<\EOF
23 +--- file1 2007-02-21 01:04:24.000000000 -0800
24 ++++ file1+ 2007-02-21 01:07:44.000000000 -0800
25 +@@ -1 +1 @@
26 +-A
27 ++B
28 +EOF
29 +
30 test_expect_success 'apply --whitespace=strip' '
31
32 rm -f sub/file1 &&
@@ -29,8 +38,12 @@ test_expect_success 'apply --whitespace=strip' '
38 then
39 echo "Eh?"
40 false
32 - else
41 + elif grep B sub/file1
42 + then
43 echo Happy
44 + else
45 + echo "Huh?"
46 + false
47 fi
48 '
49
@@ -46,6 +59,9 @@ test_expect_success 'apply --whitespace=strip from config' '
59 then
60 echo "Eh?"
61 false
62 + elif grep B sub/file1
63 + then
64 + echo Happy
65 else
66 echo Happy
67 fi
@@ -67,8 +83,12 @@ test_expect_success 'apply --whitespace=strip in subdir' '
83 then
84 echo "Eh?"
85 false
70 - else
86 + elif grep B file1
87 + then
88 echo Happy
89 + else
90 + echo "Huh?"
91 + false
92 fi
93 '
94
@@ -86,8 +106,35 @@ test_expect_success 'apply --whitespace=strip from config in subdir' '
106 then
107 echo "Eh?"
108 false
109 + elif grep B file1
110 + then
111 + echo Happy
112 else
113 + echo "Huh?"
114 + false
115 + fi
116 +'
117 +
118 +test_expect_success 'same in subdir but with traditional patch input' '
119 +
120 + cd "$D" &&
121 + git config apply.whitespace strip &&
122 + rm -f sub/file1 &&
123 + cp saved sub/file1 &&
124 + git update-index --refresh &&
125 +
126 + cd sub &&
127 + git apply -p0 ../gpatch.file &&
128 + if grep " " file1
129 + then
130 + echo "Eh?"
131 + false
132 + elif grep B file1
133 + then
134 echo Happy
135 + else
136 + echo "Huh?"
137 + false
138 fi
139 '
140