Blame


1 e9ce266e 2022-03-07 op #!/bin/sh
2 e9ce266e 2022-03-07 op #
3 e9ce266e 2022-03-07 op # Copyright (c) 2022 Omar Polo <op@openbsd.org>
4 e9ce266e 2022-03-07 op #
5 e9ce266e 2022-03-07 op # Permission to use, copy, modify, and distribute this software for any
6 e9ce266e 2022-03-07 op # purpose with or without fee is hereby granted, provided that the above
7 e9ce266e 2022-03-07 op # copyright notice and this permission notice appear in all copies.
8 e9ce266e 2022-03-07 op #
9 e9ce266e 2022-03-07 op # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 e9ce266e 2022-03-07 op # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 e9ce266e 2022-03-07 op # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 e9ce266e 2022-03-07 op # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 e9ce266e 2022-03-07 op # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 e9ce266e 2022-03-07 op # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 e9ce266e 2022-03-07 op # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 e9ce266e 2022-03-07 op
17 e9ce266e 2022-03-07 op . ./common.sh
18 e9ce266e 2022-03-07 op
19 57b1c3f2 2022-08-01 op test_patch_basic() {
20 57b1c3f2 2022-08-01 op local testroot=`test_init patch_basic`
21 e9ce266e 2022-03-07 op
22 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
23 e9ce266e 2022-03-07 op ret=$?
24 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
25 e9ce266e 2022-03-07 op test_done $testroot $ret
26 e9ce266e 2022-03-07 op return 1
27 e9ce266e 2022-03-07 op fi
28 e9ce266e 2022-03-07 op
29 2fed5287 2024-04-09 op seq 100 > $testroot/wt/numbers
30 57b1c3f2 2022-08-01 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
31 57b1c3f2 2022-08-01 op >/dev/null
32 e9ce266e 2022-03-07 op ret=$?
33 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
34 57b1c3f2 2022-08-01 op test_done "$testroot" $ret
35 e9ce266e 2022-03-07 op return 1
36 e9ce266e 2022-03-07 op fi
37 e9ce266e 2022-03-07 op
38 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
39 e9ce266e 2022-03-07 op --- alpha
40 e9ce266e 2022-03-07 op +++ alpha
41 e9ce266e 2022-03-07 op @@ -1 +1 @@
42 e9ce266e 2022-03-07 op -alpha
43 e9ce266e 2022-03-07 op +alpha is my favourite character
44 57b1c3f2 2022-08-01 op --- beta
45 57b1c3f2 2022-08-01 op +++ /dev/null
46 57b1c3f2 2022-08-01 op @@ -1 +0,0 @@
47 57b1c3f2 2022-08-01 op -beta
48 57b1c3f2 2022-08-01 op --- gamma/delta
49 57b1c3f2 2022-08-01 op +++ gamma/delta
50 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
51 57b1c3f2 2022-08-01 op +this is:
52 57b1c3f2 2022-08-01 op delta
53 57b1c3f2 2022-08-01 op --- /dev/null
54 57b1c3f2 2022-08-01 op +++ eta
55 57b1c3f2 2022-08-01 op @@ -0,0 +5,5 @@
56 57b1c3f2 2022-08-01 op +1
57 57b1c3f2 2022-08-01 op +2
58 57b1c3f2 2022-08-01 op +3
59 57b1c3f2 2022-08-01 op +4
60 57b1c3f2 2022-08-01 op +5
61 e9ce266e 2022-03-07 op --- numbers
62 e9ce266e 2022-03-07 op +++ numbers
63 e9ce266e 2022-03-07 op @@ -3,7 +3,7 @@
64 e9ce266e 2022-03-07 op 3
65 e9ce266e 2022-03-07 op 4
66 e9ce266e 2022-03-07 op 5
67 e9ce266e 2022-03-07 op -6
68 57b1c3f2 2022-08-01 op +six
69 e9ce266e 2022-03-07 op 7
70 e9ce266e 2022-03-07 op 8
71 e9ce266e 2022-03-07 op 9
72 e9ce266e 2022-03-07 op @@ -57,7 +57,7 @@
73 e9ce266e 2022-03-07 op 57
74 e9ce266e 2022-03-07 op 58
75 e9ce266e 2022-03-07 op 59
76 e9ce266e 2022-03-07 op -60
77 57b1c3f2 2022-08-01 op +sixty
78 e9ce266e 2022-03-07 op 61
79 e9ce266e 2022-03-07 op 62
80 e9ce266e 2022-03-07 op 63
81 e9ce266e 2022-03-07 op @@ -98,3 +98,6 @@
82 e9ce266e 2022-03-07 op 98
83 e9ce266e 2022-03-07 op 99
84 e9ce266e 2022-03-07 op 100
85 e9ce266e 2022-03-07 op +101
86 e9ce266e 2022-03-07 op +102
87 57b1c3f2 2022-08-01 op +103
88 e9ce266e 2022-03-07 op EOF
89 e9ce266e 2022-03-07 op
90 9cda65e5 2022-10-15 stsp (cd $testroot/wt && got patch < patch) > $testroot/stdout
91 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
92 57b1c3f2 2022-08-01 op test_done "$testroot" $ret
93 e9ce266e 2022-03-07 op return 1
94 e9ce266e 2022-03-07 op fi
95 e9ce266e 2022-03-07 op
96 57b1c3f2 2022-08-01 op echo 'M alpha' > $testroot/stdout.expected
97 57b1c3f2 2022-08-01 op echo 'D beta' >> $testroot/stdout.expected
98 57b1c3f2 2022-08-01 op echo 'M gamma/delta' >> $testroot/stdout.expected
99 57b1c3f2 2022-08-01 op echo 'A eta' >> $testroot/stdout.expected
100 57b1c3f2 2022-08-01 op echo 'M numbers' >> $testroot/stdout.expected
101 57b1c3f2 2022-08-01 op
102 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
103 e9ce266e 2022-03-07 op ret=$?
104 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
105 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
106 e9ce266e 2022-03-07 op test_done $testroot $ret
107 e9ce266e 2022-03-07 op return 1
108 e9ce266e 2022-03-07 op fi
109 e9ce266e 2022-03-07 op
110 57b1c3f2 2022-08-01 op echo 'alpha is my favourite character' > $testroot/wt/alpha.expected
111 57b1c3f2 2022-08-01 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
112 e9ce266e 2022-03-07 op ret=$?
113 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
114 57b1c3f2 2022-08-01 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
115 57b1c3f2 2022-08-01 op test_done "$testroot" $ret
116 57b1c3f2 2022-08-01 op return 1
117 e9ce266e 2022-03-07 op fi
118 e9ce266e 2022-03-07 op
119 57b1c3f2 2022-08-01 op if [ -f "$testroot/wt/beta" ]; then
120 57b1c3f2 2022-08-01 op echo "beta was not deleted!" >&2
121 57b1c3f2 2022-08-01 op test_done "$testroot" 1
122 e9ce266e 2022-03-07 op return 1
123 e9ce266e 2022-03-07 op fi
124 e9ce266e 2022-03-07 op
125 57b1c3f2 2022-08-01 op echo 'this is:' > $testroot/wt/gamma/delta.expected
126 57b1c3f2 2022-08-01 op echo 'delta' >> $testroot/wt/gamma/delta.expected
127 57b1c3f2 2022-08-01 op cmp -s $testroot/wt/gamma/delta.expected $testroot/wt/gamma/delta
128 e9ce266e 2022-03-07 op ret=$?
129 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
130 57b1c3f2 2022-08-01 op diff -u $testroot/wt/gamma/delta.expected $testroot/wt/gamma/delta
131 57b1c3f2 2022-08-01 op test_done "$testroot" $ret
132 e9ce266e 2022-03-07 op return 1
133 e9ce266e 2022-03-07 op fi
134 e9ce266e 2022-03-07 op
135 2fed5287 2024-04-09 op seq 5 > $testroot/wt/eta.expected
136 57b1c3f2 2022-08-01 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
137 e9ce266e 2022-03-07 op ret=$?
138 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
139 57b1c3f2 2022-08-01 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
140 57b1c3f2 2022-08-01 op test_done "$testroot" $ret
141 e9ce266e 2022-03-07 op return 1
142 e9ce266e 2022-03-07 op fi
143 e9ce266e 2022-03-07 op
144 2fed5287 2024-04-09 op seq 103 | sed -e 's/^6$/six/' -e 's/60/sixty/' \
145 57b1c3f2 2022-08-01 op > $testroot/wt/numbers.expected
146 57b1c3f2 2022-08-01 op cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
147 57b1c3f2 2022-08-01 op ret=$?
148 57b1c3f2 2022-08-01 op if [ $ret -ne 0 ]; then
149 57b1c3f2 2022-08-01 op diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
150 57b1c3f2 2022-08-01 op fi
151 57b1c3f2 2022-08-01 op test_done $testroot $ret
152 e9ce266e 2022-03-07 op }
153 e9ce266e 2022-03-07 op
154 e9ce266e 2022-03-07 op test_patch_dont_apply() {
155 e9ce266e 2022-03-07 op local testroot=`test_init patch_dont_apply`
156 e9ce266e 2022-03-07 op
157 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
158 e9ce266e 2022-03-07 op ret=$?
159 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
160 e9ce266e 2022-03-07 op test_done $testroot $ret
161 e9ce266e 2022-03-07 op return 1
162 e9ce266e 2022-03-07 op fi
163 e9ce266e 2022-03-07 op
164 2fed5287 2024-04-09 op seq 100 > $testroot/wt/numbers
165 5b67f96e 2022-03-13 op (cd $testroot/wt && got add numbers && got commit -m 'add numbers') \
166 5b67f96e 2022-03-13 op >/dev/null
167 5b67f96e 2022-03-13 op ret=$?
168 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
169 5b67f96e 2022-03-13 op test_done $testroot $ret
170 5b67f96e 2022-03-13 op return 1
171 5b67f96e 2022-03-13 op fi
172 5b67f96e 2022-03-13 op
173 5b67f96e 2022-03-13 op cat <<EOF > $testroot/wt/patch
174 60aa1fa0 2022-03-17 op --- alpha
175 60aa1fa0 2022-03-17 op +++ alpha
176 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
177 60aa1fa0 2022-03-17 op +hatsuseno
178 60aa1fa0 2022-03-17 op alpha something
179 5b67f96e 2022-03-13 op --- numbers
180 5b67f96e 2022-03-13 op +++ /dev/null
181 5b67f96e 2022-03-13 op @@ -1,9 +0,0 @@
182 5b67f96e 2022-03-13 op -1
183 5b67f96e 2022-03-13 op -2
184 5b67f96e 2022-03-13 op -3
185 5b67f96e 2022-03-13 op -4
186 5b67f96e 2022-03-13 op -5
187 5b67f96e 2022-03-13 op -6
188 5b67f96e 2022-03-13 op -7
189 5b67f96e 2022-03-13 op -8
190 5b67f96e 2022-03-13 op -9
191 5b67f96e 2022-03-13 op EOF
192 5b67f96e 2022-03-13 op
193 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout 2> /dev/null
194 5b67f96e 2022-03-13 op ret=$?
195 5b67f96e 2022-03-13 op if [ $ret -eq 0 ]; then # should fail
196 5b67f96e 2022-03-13 op test_done $testroot 1
197 e9ce266e 2022-03-07 op return 1
198 e9ce266e 2022-03-07 op fi
199 e9ce266e 2022-03-07 op
200 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
201 60aa1fa0 2022-03-17 op # alpha
202 60aa1fa0 2022-03-17 op @@ -1,1 +1,2 @@ hunk failed to apply
203 60aa1fa0 2022-03-17 op # numbers
204 60aa1fa0 2022-03-17 op @@ -1,9 +0,0 @@ hunk failed to apply
205 bfcdc9e9 2023-05-11 stsp Files where patch failed to apply: 2
206 60aa1fa0 2022-03-17 op EOF
207 60aa1fa0 2022-03-17 op
208 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
209 5b67f96e 2022-03-13 op ret=$?
210 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
211 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
212 5b67f96e 2022-03-13 op fi
213 e9ce266e 2022-03-07 op test_done $testroot $ret
214 e9ce266e 2022-03-07 op }
215 e9ce266e 2022-03-07 op
216 e9ce266e 2022-03-07 op test_patch_malformed() {
217 e9ce266e 2022-03-07 op local testroot=`test_init patch_malformed`
218 e9ce266e 2022-03-07 op
219 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
220 e9ce266e 2022-03-07 op ret=$?
221 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
222 e9ce266e 2022-03-07 op test_done $testroot $ret
223 e9ce266e 2022-03-07 op return 1
224 e9ce266e 2022-03-07 op fi
225 e9ce266e 2022-03-07 op
226 e9ce266e 2022-03-07 op # missing "@@"
227 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
228 e9ce266e 2022-03-07 op --- alpha
229 e9ce266e 2022-03-07 op +++ alpha
230 e9ce266e 2022-03-07 op @@ -1 +1,2
231 e9ce266e 2022-03-07 op +hatsuseno
232 e9ce266e 2022-03-07 op alpha
233 e9ce266e 2022-03-07 op EOF
234 e9ce266e 2022-03-07 op
235 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
236 e9ce266e 2022-03-07 op echo "got: malformed patch" > $testroot/stderr.expected
237 e9ce266e 2022-03-07 op
238 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
239 e9ce266e 2022-03-07 op > $testroot/stdout \
240 e9ce266e 2022-03-07 op 2> $testroot/stderr
241 e9ce266e 2022-03-07 op ret=$?
242 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
243 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
244 e9ce266e 2022-03-07 op test_done $testroot 1
245 e9ce266e 2022-03-07 op return 1
246 e9ce266e 2022-03-07 op fi
247 e9ce266e 2022-03-07 op
248 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
249 e9ce266e 2022-03-07 op ret=$?
250 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
251 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
252 e9ce266e 2022-03-07 op test_done $testroot $ret
253 e9ce266e 2022-03-07 op return 1
254 e9ce266e 2022-03-07 op fi
255 e9ce266e 2022-03-07 op
256 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
257 e9ce266e 2022-03-07 op ret=$?
258 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
259 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
260 e9ce266e 2022-03-07 op test_done $testroot $ret
261 e9ce266e 2022-03-07 op return 1
262 e9ce266e 2022-03-07 op fi
263 e9ce266e 2022-03-07 op
264 e9ce266e 2022-03-07 op # wrong first character
265 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
266 e9ce266e 2022-03-07 op --- alpha
267 e9ce266e 2022-03-07 op +++ alpha
268 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
269 e9ce266e 2022-03-07 op +hatsuseno
270 e9ce266e 2022-03-07 op alpha
271 be33dff7 2022-05-13 op EOF
272 be33dff7 2022-05-13 op
273 be33dff7 2022-05-13 op (cd $testroot/wt && got patch patch) \
274 be33dff7 2022-05-13 op > $testroot/stdout \
275 be33dff7 2022-05-13 op 2> $testroot/stderr
276 be33dff7 2022-05-13 op ret=$?
277 be33dff7 2022-05-13 op if [ $ret -eq 0 ]; then
278 be33dff7 2022-05-13 op echo "got managed to apply an invalid patch"
279 be33dff7 2022-05-13 op test_done $testroot 1
280 be33dff7 2022-05-13 op return 1
281 be33dff7 2022-05-13 op fi
282 be33dff7 2022-05-13 op
283 be33dff7 2022-05-13 op cmp -s $testroot/stdout.expected $testroot/stdout
284 be33dff7 2022-05-13 op ret=$?
285 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
286 be33dff7 2022-05-13 op diff -u $testroot/stdout.expected $testroot/stdout
287 be33dff7 2022-05-13 op test_done $testroot $ret
288 be33dff7 2022-05-13 op return 1
289 be33dff7 2022-05-13 op fi
290 be33dff7 2022-05-13 op
291 be33dff7 2022-05-13 op cmp -s $testroot/stderr.expected $testroot/stderr
292 be33dff7 2022-05-13 op ret=$?
293 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
294 be33dff7 2022-05-13 op diff -u $testroot/stderr.expected $testroot/stderr
295 be33dff7 2022-05-13 op test_done $testroot $ret
296 be33dff7 2022-05-13 op return 1
297 be33dff7 2022-05-13 op fi
298 be33dff7 2022-05-13 op
299 be33dff7 2022-05-13 op # empty hunk
300 be33dff7 2022-05-13 op cat <<EOF > $testroot/wt/patch
301 be33dff7 2022-05-13 op diff --git a/alpha b/iota
302 be33dff7 2022-05-13 op --- a/alpha
303 be33dff7 2022-05-13 op +++ b/iota
304 be33dff7 2022-05-13 op @@ -0,0 +0,0 @@
305 e9ce266e 2022-03-07 op EOF
306 e9ce266e 2022-03-07 op
307 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
308 e9ce266e 2022-03-07 op > $testroot/stdout \
309 e9ce266e 2022-03-07 op 2> $testroot/stderr
310 e9ce266e 2022-03-07 op ret=$?
311 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
312 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
313 e9ce266e 2022-03-07 op test_done $testroot 1
314 e9ce266e 2022-03-07 op return 1
315 e9ce266e 2022-03-07 op fi
316 e9ce266e 2022-03-07 op
317 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
318 e9ce266e 2022-03-07 op ret=$?
319 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
320 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
321 e9ce266e 2022-03-07 op test_done $testroot $ret
322 e9ce266e 2022-03-07 op return 1
323 e9ce266e 2022-03-07 op fi
324 e9ce266e 2022-03-07 op
325 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
326 e9ce266e 2022-03-07 op ret=$?
327 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
328 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
329 e9ce266e 2022-03-07 op test_done $testroot $ret
330 e9ce266e 2022-03-07 op return 1
331 e9ce266e 2022-03-07 op fi
332 e9ce266e 2022-03-07 op
333 e9ce266e 2022-03-07 op test_done $testroot $ret
334 e9ce266e 2022-03-07 op }
335 e9ce266e 2022-03-07 op
336 e9ce266e 2022-03-07 op test_patch_no_patch() {
337 e9ce266e 2022-03-07 op local testroot=`test_init patch_no_patch`
338 e9ce266e 2022-03-07 op
339 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
340 e9ce266e 2022-03-07 op ret=$?
341 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
342 e9ce266e 2022-03-07 op test_done $testroot $ret
343 e9ce266e 2022-03-07 op return 1
344 e9ce266e 2022-03-07 op fi
345 e9ce266e 2022-03-07 op
346 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
347 e9ce266e 2022-03-07 op hello world!
348 e9ce266e 2022-03-07 op ...
349 e9ce266e 2022-03-07 op
350 e9ce266e 2022-03-07 op some other nonsense
351 e9ce266e 2022-03-07 op ...
352 e9ce266e 2022-03-07 op
353 e9ce266e 2022-03-07 op there's no patch in here!
354 e9ce266e 2022-03-07 op EOF
355 e9ce266e 2022-03-07 op
356 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
357 e9ce266e 2022-03-07 op echo "got: no patch found" > $testroot/stderr.expected
358 e9ce266e 2022-03-07 op
359 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
360 e9ce266e 2022-03-07 op > $testroot/stdout \
361 e9ce266e 2022-03-07 op 2> $testroot/stderr
362 e9ce266e 2022-03-07 op ret=$?
363 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then # should fail
364 e9ce266e 2022-03-07 op test_done $testroot 1
365 e9ce266e 2022-03-07 op return 1
366 e9ce266e 2022-03-07 op fi
367 3313bcd8 2022-04-19 op
368 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
369 e9ce266e 2022-03-07 op ret=$?
370 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
371 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
372 e9ce266e 2022-03-07 op test_done $testroot $ret
373 e9ce266e 2022-03-07 op return 1
374 e9ce266e 2022-03-07 op fi
375 e9ce266e 2022-03-07 op
376 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
377 e9ce266e 2022-03-07 op ret=$?
378 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
379 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
380 e9ce266e 2022-03-07 op test_done $testroot $ret
381 e9ce266e 2022-03-07 op return 1
382 e9ce266e 2022-03-07 op fi
383 e9ce266e 2022-03-07 op
384 e9ce266e 2022-03-07 op test_done $testroot $ret
385 e9ce266e 2022-03-07 op }
386 e9ce266e 2022-03-07 op
387 e9ce266e 2022-03-07 op test_patch_equals_for_context() {
388 f1d6cebb 2022-04-23 op local testroot=`test_init patch_equals_for_context`
389 e9ce266e 2022-03-07 op
390 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
391 e9ce266e 2022-03-07 op ret=$?
392 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
393 e9ce266e 2022-03-07 op test_done $testroot $ret
394 e9ce266e 2022-03-07 op return 1
395 e9ce266e 2022-03-07 op fi
396 e9ce266e 2022-03-07 op
397 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
398 e9ce266e 2022-03-07 op --- alpha
399 e9ce266e 2022-03-07 op +++ alpha
400 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
401 e9ce266e 2022-03-07 op +hatsuseno
402 e9ce266e 2022-03-07 op =alpha
403 e9ce266e 2022-03-07 op EOF
404 e9ce266e 2022-03-07 op
405 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
406 e9ce266e 2022-03-07 op
407 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
408 e9ce266e 2022-03-07 op ret=$?
409 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
410 e9ce266e 2022-03-07 op test_done $testroot $ret
411 e9ce266e 2022-03-07 op return 1
412 e9ce266e 2022-03-07 op fi
413 e9ce266e 2022-03-07 op
414 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
415 e9ce266e 2022-03-07 op ret=$?
416 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
417 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
418 e9ce266e 2022-03-07 op test_done $testroot $ret
419 e9ce266e 2022-03-07 op return 1
420 e9ce266e 2022-03-07 op fi
421 e9ce266e 2022-03-07 op
422 e9ce266e 2022-03-07 op echo hatsuseno > $testroot/wt/alpha.expected
423 e9ce266e 2022-03-07 op echo alpha >> $testroot/wt/alpha.expected
424 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
425 e9ce266e 2022-03-07 op ret=$?
426 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
427 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
428 e9ce266e 2022-03-07 op fi
429 e9ce266e 2022-03-07 op test_done $testroot $ret
430 e9ce266e 2022-03-07 op }
431 6e96b326 2022-03-12 op
432 6e96b326 2022-03-12 op test_patch_rename() {
433 6e96b326 2022-03-12 op local testroot=`test_init patch_rename`
434 6e96b326 2022-03-12 op
435 6e96b326 2022-03-12 op got checkout $testroot/repo $testroot/wt > /dev/null
436 6e96b326 2022-03-12 op ret=$?
437 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
438 6e96b326 2022-03-12 op test_done $testroot $ret
439 6e96b326 2022-03-12 op return 1
440 6e96b326 2022-03-12 op fi
441 6e96b326 2022-03-12 op
442 6e96b326 2022-03-12 op cat <<EOF > $testroot/wt/patch
443 4379a9aa 2022-05-02 op diff --git a/beta b/iota
444 4379a9aa 2022-05-02 op similarity index 100%
445 4379a9aa 2022-05-02 op rename from beta
446 4379a9aa 2022-05-02 op rename to iota
447 7a30b5cb 2022-03-20 op diff --git a/alpha b/eta
448 7a30b5cb 2022-03-20 op --- a/alpha
449 7a30b5cb 2022-03-20 op +++ b/eta
450 4379a9aa 2022-05-02 op @@ -1 +1 @@
451 4379a9aa 2022-05-02 op -alpha
452 4379a9aa 2022-05-02 op +eta
453 6e96b326 2022-03-12 op EOF
454 e9ce266e 2022-03-07 op
455 4379a9aa 2022-05-02 op echo 'D beta' > $testroot/stdout.expected
456 4379a9aa 2022-05-02 op echo 'A iota' >> $testroot/stdout.expected
457 4379a9aa 2022-05-02 op echo 'D alpha' >> $testroot/stdout.expected
458 4379a9aa 2022-05-02 op echo 'A eta' >> $testroot/stdout.expected
459 6e96b326 2022-03-12 op
460 6e96b326 2022-03-12 op (cd $testroot/wt && got patch patch) > $testroot/stdout
461 6e96b326 2022-03-12 op ret=$?
462 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
463 6e96b326 2022-03-12 op test_done $testroot $ret
464 6e96b326 2022-03-12 op return 1
465 6e96b326 2022-03-12 op fi
466 6e96b326 2022-03-12 op
467 6e96b326 2022-03-12 op cmp -s $testroot/stdout.expected $testroot/stdout
468 6e96b326 2022-03-12 op ret=$?
469 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
470 6e96b326 2022-03-12 op diff -u $testroot/stdout.expected $testroot/stdout
471 6e96b326 2022-03-12 op test_done $testroot $ret
472 6e96b326 2022-03-12 op return 1
473 6e96b326 2022-03-12 op fi
474 6e96b326 2022-03-12 op
475 4379a9aa 2022-05-02 op if [ -f $testroot/wt/alpha -o -f $testroot/wt/beta ]; then
476 4379a9aa 2022-05-02 op echo "alpha or beta were not removed" >&2
477 6e96b326 2022-03-12 op test_done $testroot 1
478 6e96b326 2022-03-12 op return 1
479 6e96b326 2022-03-12 op fi
480 4379a9aa 2022-05-02 op if [ ! -f $testroot/wt/iota -o ! -f $testroot/wt/eta ]; then
481 4379a9aa 2022-05-02 op echo "iota or eta were not created" >&2
482 6e96b326 2022-03-12 op test_done $testroot 1
483 6e96b326 2022-03-12 op return 1
484 6e96b326 2022-03-12 op fi
485 6e96b326 2022-03-12 op
486 4379a9aa 2022-05-02 op echo beta > $testroot/wt/iota.expected
487 4379a9aa 2022-05-02 op cmp -s $testroot/wt/iota.expected $testroot/wt/iota
488 6e96b326 2022-03-12 op ret=$?
489 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
490 4379a9aa 2022-05-02 op diff -u $testroot/wt/iota.expected $testroot/wt/iota
491 6e96b326 2022-03-12 op test_done $testroot $ret
492 6e96b326 2022-03-12 op return 1
493 6e96b326 2022-03-12 op fi
494 6e96b326 2022-03-12 op
495 4379a9aa 2022-05-02 op echo eta > $testroot/wt/eta.expected
496 4379a9aa 2022-05-02 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
497 6e96b326 2022-03-12 op ret=$?
498 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
499 4379a9aa 2022-05-02 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
500 6e96b326 2022-03-12 op test_done $testroot $ret
501 6e96b326 2022-03-12 op return 1
502 6e96b326 2022-03-12 op fi
503 6e96b326 2022-03-12 op
504 6e96b326 2022-03-12 op test_done $testroot $ret
505 6e96b326 2022-03-12 op }
506 dbda770b 2022-03-13 op
507 dbda770b 2022-03-13 op test_patch_illegal_status() {
508 dbda770b 2022-03-13 op local testroot=`test_init patch_illegal_status`
509 dbda770b 2022-03-13 op
510 dbda770b 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
511 dbda770b 2022-03-13 op ret=$?
512 dbda770b 2022-03-13 op if [ $ret -ne 0 ]; then
513 dbda770b 2022-03-13 op test_done $testroot $ret
514 dbda770b 2022-03-13 op return 1
515 dbda770b 2022-03-13 op fi
516 dbda770b 2022-03-13 op
517 60aa1fa0 2022-03-17 op # try to patch an obstructed file, add a versioned one, edit a
518 60aa1fa0 2022-03-17 op # non existent file and an unversioned one, and remove a
519 60aa1fa0 2022-03-17 op # non existent file.
520 dbda770b 2022-03-13 op cat <<EOF > $testroot/wt/patch
521 60aa1fa0 2022-03-17 op --- alpha
522 60aa1fa0 2022-03-17 op +++ alpha
523 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
524 60aa1fa0 2022-03-17 op alpha
525 60aa1fa0 2022-03-17 op +was edited
526 60aa1fa0 2022-03-17 op --- /dev/null
527 60aa1fa0 2022-03-17 op +++ beta
528 60aa1fa0 2022-03-17 op @@ -0,0 +1 @@
529 60aa1fa0 2022-03-17 op +beta
530 dbda770b 2022-03-13 op --- iota
531 dbda770b 2022-03-13 op +++ iota
532 dbda770b 2022-03-13 op @@ -1 +1 @@
533 60aa1fa0 2022-03-17 op -iota
534 60aa1fa0 2022-03-17 op +IOTA
535 60aa1fa0 2022-03-17 op --- kappa
536 60aa1fa0 2022-03-17 op +++ kappa
537 60aa1fa0 2022-03-17 op @@ -1 +1 @@
538 60aa1fa0 2022-03-17 op -kappa
539 60aa1fa0 2022-03-17 op +KAPPA
540 60aa1fa0 2022-03-17 op --- lambda
541 60aa1fa0 2022-03-17 op +++ /dev/null
542 60aa1fa0 2022-03-17 op @@ -1 +0,0 @@
543 60aa1fa0 2022-03-17 op -lambda
544 dbda770b 2022-03-13 op EOF
545 6e96b326 2022-03-12 op
546 60aa1fa0 2022-03-17 op echo kappa > $testroot/wt/kappa
547 dbda770b 2022-03-13 op rm $testroot/wt/alpha
548 dbda770b 2022-03-13 op mkdir $testroot/wt/alpha
549 dbda770b 2022-03-13 op
550 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout \
551 dbda770b 2022-03-13 op 2> $testroot/stderr
552 dbda770b 2022-03-13 op ret=$?
553 dbda770b 2022-03-13 op if [ $ret -eq 0 ]; then
554 dbda770b 2022-03-13 op echo "edited a missing file" >&2
555 a19f439c 2022-06-03 op test_done $testroot 1
556 dbda770b 2022-03-13 op return 1
557 dbda770b 2022-03-13 op fi
558 dbda770b 2022-03-13 op
559 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
560 60aa1fa0 2022-03-17 op # alpha
561 60aa1fa0 2022-03-17 op # beta
562 60aa1fa0 2022-03-17 op # iota
563 60aa1fa0 2022-03-17 op # kappa
564 60aa1fa0 2022-03-17 op # lambda
565 bfcdc9e9 2023-05-11 stsp Files where patch failed to apply: 5
566 60aa1fa0 2022-03-17 op EOF
567 dbda770b 2022-03-13 op
568 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stderr.expected
569 60aa1fa0 2022-03-17 op got: alpha: file has unexpected status
570 60aa1fa0 2022-03-17 op got: beta: file has unexpected status
571 60aa1fa0 2022-03-17 op got: iota: No such file or directory
572 60aa1fa0 2022-03-17 op got: kappa: file has unexpected status
573 60aa1fa0 2022-03-17 op got: lambda: No such file or directory
574 60aa1fa0 2022-03-17 op got: patch failed to apply
575 dbda770b 2022-03-13 op EOF
576 dbda770b 2022-03-13 op
577 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
578 dbda770b 2022-03-13 op ret=$?
579 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
580 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
581 dbda770b 2022-03-13 op test_done $testroot $ret
582 dbda770b 2022-03-13 op return 1
583 dbda770b 2022-03-13 op fi
584 dbda770b 2022-03-13 op
585 dbda770b 2022-03-13 op cmp -s $testroot/stderr.expected $testroot/stderr
586 dbda770b 2022-03-13 op ret=$?
587 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
588 dbda770b 2022-03-13 op diff -u $testroot/stderr.expected $testroot/stderr
589 78f5ac24 2022-03-19 op test_done $testroot $ret
590 78f5ac24 2022-03-19 op return 1
591 dbda770b 2022-03-13 op fi
592 78f5ac24 2022-03-19 op
593 78f5ac24 2022-03-19 op (cd $testroot/wt && got status) > $testroot/stdout
594 78f5ac24 2022-03-19 op cat <<EOF > $testroot/stdout.expected
595 78f5ac24 2022-03-19 op ~ alpha
596 78f5ac24 2022-03-19 op ? kappa
597 78f5ac24 2022-03-19 op ? patch
598 78f5ac24 2022-03-19 op EOF
599 78f5ac24 2022-03-19 op
600 78f5ac24 2022-03-19 op cmp -s $testroot/stdout.expected $testroot/stdout
601 78f5ac24 2022-03-19 op ret=$?
602 78f5ac24 2022-03-19 op if [ $ret -ne 0 ]; then
603 78f5ac24 2022-03-19 op diff -u $testroot/stdout.expected $testroot/stdout
604 78f5ac24 2022-03-19 op fi
605 899fcfdf 2022-03-13 op test_done $testroot $ret
606 899fcfdf 2022-03-13 op }
607 899fcfdf 2022-03-13 op
608 899fcfdf 2022-03-13 op test_patch_nop() {
609 899fcfdf 2022-03-13 op local testroot=`test_init patch_nop`
610 899fcfdf 2022-03-13 op
611 899fcfdf 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
612 899fcfdf 2022-03-13 op ret=$?
613 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
614 899fcfdf 2022-03-13 op test_done $testroot $ret
615 899fcfdf 2022-03-13 op return 1
616 899fcfdf 2022-03-13 op fi
617 899fcfdf 2022-03-13 op
618 899fcfdf 2022-03-13 op cat <<EOF > $testroot/wt/patch
619 899fcfdf 2022-03-13 op --- alpha
620 899fcfdf 2022-03-13 op +++ alpha
621 899fcfdf 2022-03-13 op @@ -1 +1 @@
622 899fcfdf 2022-03-13 op -alpha
623 899fcfdf 2022-03-13 op +cafe alpha
624 899fcfdf 2022-03-13 op --- beta
625 899fcfdf 2022-03-13 op +++ /dev/null
626 899fcfdf 2022-03-13 op @@ -1 +0,0 @@
627 899fcfdf 2022-03-13 op -beta
628 7a30b5cb 2022-03-20 op diff --git a/gamma/delta b/gamma/delta.new
629 899fcfdf 2022-03-13 op --- gamma/delta
630 899fcfdf 2022-03-13 op +++ gamma/delta.new
631 899fcfdf 2022-03-13 op @@ -1 +1 @@
632 899fcfdf 2022-03-13 op -delta
633 899fcfdf 2022-03-13 op +delta updated and renamed!
634 899fcfdf 2022-03-13 op EOF
635 899fcfdf 2022-03-13 op
636 899fcfdf 2022-03-13 op (cd $testroot/wt && got patch -n patch)
637 899fcfdf 2022-03-13 op ret=$?
638 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
639 899fcfdf 2022-03-13 op test_done $testroot $ret
640 899fcfdf 2022-03-13 op return 1
641 dbda770b 2022-03-13 op fi
642 899fcfdf 2022-03-13 op
643 899fcfdf 2022-03-13 op # remove the patch to avoid the ? entry
644 899fcfdf 2022-03-13 op rm $testroot/wt/patch
645 899fcfdf 2022-03-13 op
646 899fcfdf 2022-03-13 op (cd $testroot/wt && got status) > $testroot/stdout
647 899fcfdf 2022-03-13 op ret=$?
648 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
649 899fcfdf 2022-03-13 op test_done $testroot $ret
650 899fcfdf 2022-03-13 op return 1
651 899fcfdf 2022-03-13 op fi
652 899fcfdf 2022-03-13 op
653 899fcfdf 2022-03-13 op echo -n > $testroot/stdout.expected
654 899fcfdf 2022-03-13 op cmp -s $testroot/stdout.expected $testroot/stdout
655 899fcfdf 2022-03-13 op ret=$?
656 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
657 899fcfdf 2022-03-13 op diff -u $testroot/stdout.expected $testroot/stdout
658 899fcfdf 2022-03-13 op fi
659 dbda770b 2022-03-13 op test_done $testroot $ret
660 2be5e1a2 2022-03-16 op }
661 2be5e1a2 2022-03-16 op
662 2be5e1a2 2022-03-16 op test_patch_preserve_perm() {
663 2be5e1a2 2022-03-16 op local testroot=`test_init patch_preserve_perm`
664 2be5e1a2 2022-03-16 op
665 2be5e1a2 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
666 2be5e1a2 2022-03-16 op ret=$?
667 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
668 2be5e1a2 2022-03-16 op test_done $testroot $ret
669 2be5e1a2 2022-03-16 op return 1
670 2be5e1a2 2022-03-16 op fi
671 2be5e1a2 2022-03-16 op
672 2be5e1a2 2022-03-16 op chmod +x $testroot/wt/alpha
673 2be5e1a2 2022-03-16 op (cd $testroot/wt && got commit -m 'alpha executable') > /dev/null
674 2be5e1a2 2022-03-16 op ret=$?
675 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
676 2be5e1a2 2022-03-16 op test_done $testroot $ret
677 2be5e1a2 2022-03-16 op return 1
678 2be5e1a2 2022-03-16 op fi
679 2be5e1a2 2022-03-16 op
680 2be5e1a2 2022-03-16 op cat <<EOF > $testroot/wt/patch
681 2be5e1a2 2022-03-16 op --- alpha
682 2be5e1a2 2022-03-16 op +++ alpha
683 2be5e1a2 2022-03-16 op @@ -1 +1,2 @@
684 2be5e1a2 2022-03-16 op alpha
685 2be5e1a2 2022-03-16 op +was edited
686 2be5e1a2 2022-03-16 op EOF
687 2be5e1a2 2022-03-16 op
688 2be5e1a2 2022-03-16 op (cd $testroot/wt && got patch patch) > /dev/null
689 2be5e1a2 2022-03-16 op ret=$?
690 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
691 2be5e1a2 2022-03-16 op test_done $testroot $ret
692 2be5e1a2 2022-03-16 op return 1
693 2be5e1a2 2022-03-16 op fi
694 2be5e1a2 2022-03-16 op
695 2be5e1a2 2022-03-16 op if [ ! -x $testroot/wt/alpha ]; then
696 2be5e1a2 2022-03-16 op echo "alpha is no more executable!" >&2
697 2be5e1a2 2022-03-16 op test_done $testroot 1
698 95d68340 2022-03-16 op return 1
699 95d68340 2022-03-16 op fi
700 95d68340 2022-03-16 op test_done $testroot 0
701 95d68340 2022-03-16 op }
702 95d68340 2022-03-16 op
703 95d68340 2022-03-16 op test_patch_create_dirs() {
704 95d68340 2022-03-16 op local testroot=`test_init patch_create_dirs`
705 95d68340 2022-03-16 op
706 95d68340 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
707 95d68340 2022-03-16 op ret=$?
708 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
709 95d68340 2022-03-16 op test_done $testroot $ret
710 95d68340 2022-03-16 op return 1
711 95d68340 2022-03-16 op fi
712 95d68340 2022-03-16 op
713 95d68340 2022-03-16 op cat <<EOF > $testroot/wt/patch
714 95d68340 2022-03-16 op --- /dev/null
715 95d68340 2022-03-16 op +++ iota/kappa/lambda
716 95d68340 2022-03-16 op @@ -0,0 +1 @@
717 95d68340 2022-03-16 op +lambda
718 95d68340 2022-03-16 op EOF
719 95d68340 2022-03-16 op
720 95d68340 2022-03-16 op (cd $testroot/wt && got patch patch) > $testroot/stdout
721 95d68340 2022-03-16 op ret=$?
722 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
723 95d68340 2022-03-16 op test_done $testroot $ret
724 2be5e1a2 2022-03-16 op return 1
725 2be5e1a2 2022-03-16 op fi
726 95d68340 2022-03-16 op
727 95d68340 2022-03-16 op echo 'A iota/kappa/lambda' >> $testroot/stdout.expected
728 95d68340 2022-03-16 op cmp -s $testroot/stdout.expected $testroot/stdout
729 95d68340 2022-03-16 op ret=$?
730 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
731 95d68340 2022-03-16 op diff -u $testroot/stdout.expected $testroot/stdout
732 95d68340 2022-03-16 op test_done $testroot $ret
733 95d68340 2022-03-16 op return 1
734 95d68340 2022-03-16 op fi
735 95d68340 2022-03-16 op
736 95d68340 2022-03-16 op if [ ! -f $testroot/wt/iota/kappa/lambda ]; then
737 95d68340 2022-03-16 op echo "file not created!" >&2
738 95d68340 2022-03-16 op test_done $testroot $ret
739 95d68340 2022-03-16 op return 1
740 95d68340 2022-03-16 op fi
741 2be5e1a2 2022-03-16 op test_done $testroot 0
742 dbda770b 2022-03-13 op }
743 dbda770b 2022-03-13 op
744 60aa1fa0 2022-03-17 op test_patch_with_offset() {
745 60aa1fa0 2022-03-17 op local testroot=`test_init patch_with_offset`
746 60aa1fa0 2022-03-17 op
747 60aa1fa0 2022-03-17 op got checkout $testroot/repo $testroot/wt > /dev/null
748 60aa1fa0 2022-03-17 op ret=$?
749 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
750 60aa1fa0 2022-03-17 op test_done $testroot $ret
751 60aa1fa0 2022-03-17 op return 1
752 60aa1fa0 2022-03-17 op fi
753 60aa1fa0 2022-03-17 op
754 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/wt/patch
755 60aa1fa0 2022-03-17 op --- numbers
756 60aa1fa0 2022-03-17 op +++ numbers
757 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@
758 60aa1fa0 2022-03-17 op 47
759 60aa1fa0 2022-03-17 op 48
760 60aa1fa0 2022-03-17 op 49
761 60aa1fa0 2022-03-17 op -50
762 60aa1fa0 2022-03-17 op +midway tru it!
763 60aa1fa0 2022-03-17 op 51
764 60aa1fa0 2022-03-17 op 52
765 60aa1fa0 2022-03-17 op 53
766 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@
767 60aa1fa0 2022-03-17 op 87
768 60aa1fa0 2022-03-17 op 88
769 60aa1fa0 2022-03-17 op 89
770 60aa1fa0 2022-03-17 op -90
771 60aa1fa0 2022-03-17 op +almost there!
772 60aa1fa0 2022-03-17 op 91
773 60aa1fa0 2022-03-17 op 92
774 60aa1fa0 2022-03-17 op 93
775 60aa1fa0 2022-03-17 op EOF
776 60aa1fa0 2022-03-17 op
777 2fed5287 2024-04-09 op seq 100 > $testroot/wt/numbers
778 5f94a4e0 2022-11-18 op ed -s "$testroot/wt/numbers" <<EOF
779 60aa1fa0 2022-03-17 op 1,10d
780 2fed5287 2024-04-09 op 50r !seq 20
781 60aa1fa0 2022-03-17 op w
782 60aa1fa0 2022-03-17 op q
783 60aa1fa0 2022-03-17 op EOF
784 60aa1fa0 2022-03-17 op
785 60aa1fa0 2022-03-17 op (cd $testroot/wt && got add numbers && got commit -m '+numbers') \
786 60aa1fa0 2022-03-17 op > /dev/null
787 60aa1fa0 2022-03-17 op ret=$?
788 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
789 60aa1fa0 2022-03-17 op test_done $testroot $ret
790 60aa1fa0 2022-03-17 op return 1
791 60aa1fa0 2022-03-17 op fi
792 60aa1fa0 2022-03-17 op
793 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout
794 60aa1fa0 2022-03-17 op ret=$?
795 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
796 60aa1fa0 2022-03-17 op test_done $testroot/wt $ret
797 60aa1fa0 2022-03-17 op return 1
798 60aa1fa0 2022-03-17 op fi
799 60aa1fa0 2022-03-17 op
800 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
801 60aa1fa0 2022-03-17 op M numbers
802 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@ applied with offset -10
803 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@ applied with offset 10
804 04a87797 2024-04-23 op EOF
805 04a87797 2024-04-23 op
806 04a87797 2024-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
807 04a87797 2024-04-23 op ret=$?
808 04a87797 2024-04-23 op if [ $ret -ne 0 ]; then
809 04a87797 2024-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
810 04a87797 2024-04-23 op fi
811 04a87797 2024-04-23 op test_done $testroot $ret
812 04a87797 2024-04-23 op }
813 04a87797 2024-04-23 op
814 04a87797 2024-04-23 op test_patch_empty_file() {
815 04a87797 2024-04-23 op local testroot=`test_init patch_empty_file`
816 04a87797 2024-04-23 op
817 04a87797 2024-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
818 04a87797 2024-04-23 op ret=$?
819 04a87797 2024-04-23 op if [ $ret -ne 0 ]; then
820 04a87797 2024-04-23 op test_done $testroot $ret
821 04a87797 2024-04-23 op return 1
822 04a87797 2024-04-23 op fi
823 04a87797 2024-04-23 op
824 04a87797 2024-04-23 op echo -n > $testroot/wt/alpha
825 04a87797 2024-04-23 op (cd "$testroot/wt" && got commit -m 'edit alpha' alpha) >/dev/null
826 27aa2674 2024-04-23 stsp
827 27aa2674 2024-04-23 stsp # try a patch which re-adds file contents; should suceeed
828 04a87797 2024-04-23 op cat <<EOF >$testroot/wt/patch
829 04a87797 2024-04-23 op --- alpha
830 04a87797 2024-04-23 op +++ alpha
831 04a87797 2024-04-23 op @@ -0,0 +1 @@
832 04a87797 2024-04-23 op +alpha
833 7a30b5cb 2022-03-20 op EOF
834 04a87797 2024-04-23 op (cd $testroot/wt && got patch patch) > $testroot/stdout
835 04a87797 2024-04-23 op ret=$?
836 04a87797 2024-04-23 op if [ $ret -ne 0 ]; then
837 04a87797 2024-04-23 op test_done $testroot $ret
838 04a87797 2024-04-23 op return 1
839 04a87797 2024-04-23 op fi
840 04a87797 2024-04-23 op echo 'M alpha' > $testroot/stdout.expected
841 7a30b5cb 2022-03-20 op cmp -s $testroot/stdout.expected $testroot/stdout
842 7a30b5cb 2022-03-20 op ret=$?
843 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
844 7a30b5cb 2022-03-20 op diff -u $testroot/stdout.expected $testroot/stdout
845 27aa2674 2024-04-23 stsp test_done $testroot $ret
846 27aa2674 2024-04-23 stsp return 1
847 7a30b5cb 2022-03-20 op fi
848 27aa2674 2024-04-23 stsp
849 27aa2674 2024-04-23 stsp (cd $testroot/wt && got revert -R . > /dev/null)
850 27aa2674 2024-04-23 stsp
851 27aa2674 2024-04-23 stsp # try a patch which edits the file; should fail
852 27aa2674 2024-04-23 stsp cat <<EOF >$testroot/wt/patch
853 27aa2674 2024-04-23 stsp --- alpha
854 27aa2674 2024-04-23 stsp +++ alpha
855 27aa2674 2024-04-23 stsp @@ -1 +1 @@
856 27aa2674 2024-04-23 stsp -alpha
857 27aa2674 2024-04-23 stsp +beta
858 27aa2674 2024-04-23 stsp EOF
859 27aa2674 2024-04-23 stsp (cd $testroot/wt && got patch patch) > $testroot/stdout \
860 27aa2674 2024-04-23 stsp 2> $testroot/stderr
861 27aa2674 2024-04-23 stsp ret=$?
862 27aa2674 2024-04-23 stsp if [ $ret -eq 0 ]; then
863 27aa2674 2024-04-23 stsp echo "got patch suceeded unexpectedly" >&2
864 27aa2674 2024-04-23 stsp test_done $testroot $ret
865 27aa2674 2024-04-23 stsp return 1
866 27aa2674 2024-04-23 stsp fi
867 27aa2674 2024-04-23 stsp
868 27aa2674 2024-04-23 stsp echo 'got: patch failed to apply' > $testroot/stderr.expected
869 27aa2674 2024-04-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
870 27aa2674 2024-04-23 stsp ret=$?
871 27aa2674 2024-04-23 stsp if [ $ret -ne 0 ]; then
872 27aa2674 2024-04-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
873 27aa2674 2024-04-23 stsp test_done $testroot $ret
874 27aa2674 2024-04-23 stsp return 1
875 27aa2674 2024-04-23 stsp fi
876 27aa2674 2024-04-23 stsp
877 27aa2674 2024-04-23 stsp (cd $testroot/wt && got revert -R . > /dev/null)
878 27aa2674 2024-04-23 stsp
879 27aa2674 2024-04-23 stsp # try a patch which deletes lines from the file; should fail
880 27aa2674 2024-04-23 stsp cat <<EOF >$testroot/wt/patch
881 27aa2674 2024-04-23 stsp --- alpha
882 27aa2674 2024-04-23 stsp +++ alpha
883 27aa2674 2024-04-23 stsp @@ -1,2 +0 @@
884 27aa2674 2024-04-23 stsp -alpha
885 27aa2674 2024-04-23 stsp -beta
886 27aa2674 2024-04-23 stsp EOF
887 27aa2674 2024-04-23 stsp (cd $testroot/wt && got patch patch) > $testroot/stdout \
888 27aa2674 2024-04-23 stsp 2> $testroot/stderr
889 27aa2674 2024-04-23 stsp ret=$?
890 27aa2674 2024-04-23 stsp if [ $ret -eq 0 ]; then
891 27aa2674 2024-04-23 stsp echo "got patch suceeded unexpectedly" >&2
892 27aa2674 2024-04-23 stsp test_done $testroot $ret
893 27aa2674 2024-04-23 stsp return 1
894 27aa2674 2024-04-23 stsp fi
895 27aa2674 2024-04-23 stsp echo 'got: patch failed to apply' > $testroot/stderr.expected
896 27aa2674 2024-04-23 stsp cmp -s $testroot/stderr.expected $testroot/stderr
897 27aa2674 2024-04-23 stsp ret=$?
898 27aa2674 2024-04-23 stsp if [ $ret -ne 0 ]; then
899 27aa2674 2024-04-23 stsp diff -u $testroot/stderr.expected $testroot/stderr
900 27aa2674 2024-04-23 stsp fi
901 7a30b5cb 2022-03-20 op test_done $testroot $ret
902 7a30b5cb 2022-03-20 op }
903 7a30b5cb 2022-03-20 op
904 7a30b5cb 2022-03-20 op test_patch_prefer_new_path() {
905 7a30b5cb 2022-03-20 op local testroot=`test_init patch_orig`
906 7a30b5cb 2022-03-20 op
907 7a30b5cb 2022-03-20 op got checkout $testroot/repo $testroot/wt > /dev/null
908 7a30b5cb 2022-03-20 op ret=$?
909 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
910 7a30b5cb 2022-03-20 op test_done $testroot $ret
911 7a30b5cb 2022-03-20 op return 1
912 7a30b5cb 2022-03-20 op fi
913 7a30b5cb 2022-03-20 op
914 7a30b5cb 2022-03-20 op cat <<EOF > $testroot/wt/patch
915 7a30b5cb 2022-03-20 op --- alpha.orig
916 7a30b5cb 2022-03-20 op +++ alpha
917 7a30b5cb 2022-03-20 op @@ -1 +1,2 @@
918 7a30b5cb 2022-03-20 op alpha
919 7a30b5cb 2022-03-20 op +was edited
920 60aa1fa0 2022-03-17 op EOF
921 60aa1fa0 2022-03-17 op
922 7a30b5cb 2022-03-20 op (cd $testroot/wt && got patch patch) > $testroot/stdout
923 7a30b5cb 2022-03-20 op ret=$?
924 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
925 7a30b5cb 2022-03-20 op test_done $testroot $ret
926 7a30b5cb 2022-03-20 op return 1
927 7a30b5cb 2022-03-20 op fi
928 7a30b5cb 2022-03-20 op
929 3313bcd8 2022-04-19 op echo 'M alpha' > $testroot/stdout.expected
930 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
931 60aa1fa0 2022-03-17 op ret=$?
932 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
933 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
934 60aa1fa0 2022-03-17 op fi
935 60aa1fa0 2022-03-17 op test_done $testroot $ret
936 60aa1fa0 2022-03-17 op }
937 60aa1fa0 2022-03-17 op
938 b3c57ab2 2022-03-22 op test_patch_no_newline() {
939 b3c57ab2 2022-03-22 op local testroot=`test_init patch_no_newline`
940 b3c57ab2 2022-03-22 op
941 b3c57ab2 2022-03-22 op got checkout $testroot/repo $testroot/wt > /dev/null
942 b3c57ab2 2022-03-22 op ret=$?
943 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
944 b3c57ab2 2022-03-22 op test_done $testroot $ret
945 b3c57ab2 2022-03-22 op return 1
946 b3c57ab2 2022-03-22 op fi
947 b3c57ab2 2022-03-22 op
948 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
949 b3c57ab2 2022-03-22 op --- /dev/null
950 b3c57ab2 2022-03-22 op +++ eta
951 b3c57ab2 2022-03-22 op @@ -0,0 +1 @@
952 b3c57ab2 2022-03-22 op +eta
953 b3c57ab2 2022-03-22 op \ No newline at end of file
954 b3c57ab2 2022-03-22 op EOF
955 b3c57ab2 2022-03-22 op
956 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
957 b3c57ab2 2022-03-22 op ret=$?
958 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
959 b3c57ab2 2022-03-22 op test_done $testroot $ret
960 b3c57ab2 2022-03-22 op return 1
961 b3c57ab2 2022-03-22 op fi
962 b3c57ab2 2022-03-22 op
963 b3c57ab2 2022-03-22 op echo "A eta" > $testroot/stdout.expected
964 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
965 b3c57ab2 2022-03-22 op ret=$?
966 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
967 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
968 b3c57ab2 2022-03-22 op test_done $testroot $ret
969 b3c57ab2 2022-03-22 op return 1
970 b3c57ab2 2022-03-22 op fi
971 b3c57ab2 2022-03-22 op
972 b3c57ab2 2022-03-22 op echo -n eta > $testroot/wt/eta.expected
973 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
974 b3c57ab2 2022-03-22 op ret=$?
975 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
976 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
977 b3c57ab2 2022-03-22 op test_done $testroot $ret
978 b3c57ab2 2022-03-22 op return 1
979 b3c57ab2 2022-03-22 op fi
980 b3c57ab2 2022-03-22 op
981 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'add eta') > /dev/null
982 b3c57ab2 2022-03-22 op ret=$?
983 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
984 b3c57ab2 2022-03-22 op test_done $testroot $ret
985 b3c57ab2 2022-03-22 op return 1
986 b3c57ab2 2022-03-22 op fi
987 b3c57ab2 2022-03-22 op
988 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
989 b3c57ab2 2022-03-22 op --- eta
990 b3c57ab2 2022-03-22 op +++ eta
991 b3c57ab2 2022-03-22 op @@ -1 +1 @@
992 b3c57ab2 2022-03-22 op -eta
993 b3c57ab2 2022-03-22 op \ No newline at end of file
994 b3c57ab2 2022-03-22 op +ETA
995 b3c57ab2 2022-03-22 op \ No newline at end of file
996 b3c57ab2 2022-03-22 op EOF
997 b3c57ab2 2022-03-22 op
998 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
999 b3c57ab2 2022-03-22 op ret=$?
1000 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1001 b3c57ab2 2022-03-22 op test_done $testroot $ret
1002 b3c57ab2 2022-03-22 op return 1
1003 b3c57ab2 2022-03-22 op fi
1004 b3c57ab2 2022-03-22 op
1005 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1006 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1007 b3c57ab2 2022-03-22 op ret=$?
1008 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1009 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1010 b3c57ab2 2022-03-22 op test_done $testroot $ret
1011 b3c57ab2 2022-03-22 op return 1
1012 b3c57ab2 2022-03-22 op fi
1013 b3c57ab2 2022-03-22 op
1014 b3c57ab2 2022-03-22 op echo -n ETA > $testroot/wt/eta.expected
1015 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1016 b3c57ab2 2022-03-22 op ret=$?
1017 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1018 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1019 b3c57ab2 2022-03-22 op test_done $testroot $ret
1020 b3c57ab2 2022-03-22 op return 1
1021 b3c57ab2 2022-03-22 op fi
1022 b3c57ab2 2022-03-22 op
1023 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'edit eta') > /dev/null
1024 b3c57ab2 2022-03-22 op ret=$?
1025 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1026 b3c57ab2 2022-03-22 op test_done $testroot $ret
1027 b3c57ab2 2022-03-22 op return 1
1028 b3c57ab2 2022-03-22 op fi
1029 b3c57ab2 2022-03-22 op
1030 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1031 b3c57ab2 2022-03-22 op --- eta
1032 b3c57ab2 2022-03-22 op +++ eta
1033 b3c57ab2 2022-03-22 op @@ -1 +1 @@
1034 b3c57ab2 2022-03-22 op -ETA
1035 b3c57ab2 2022-03-22 op \ No newline at end of file
1036 b3c57ab2 2022-03-22 op +eta
1037 b3c57ab2 2022-03-22 op EOF
1038 b3c57ab2 2022-03-22 op
1039 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1040 b3c57ab2 2022-03-22 op ret=$?
1041 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1042 b3c57ab2 2022-03-22 op test_done $testroot $ret
1043 b3c57ab2 2022-03-22 op return 1
1044 b3c57ab2 2022-03-22 op fi
1045 b3c57ab2 2022-03-22 op
1046 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1047 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1048 b3c57ab2 2022-03-22 op ret=$?
1049 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1050 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1051 b3c57ab2 2022-03-22 op test_done $testroot $ret
1052 b3c57ab2 2022-03-22 op return 1
1053 b3c57ab2 2022-03-22 op fi
1054 b3c57ab2 2022-03-22 op
1055 b3c57ab2 2022-03-22 op echo eta > $testroot/wt/eta.expected
1056 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1057 b3c57ab2 2022-03-22 op ret=$?
1058 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1059 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1060 b3c57ab2 2022-03-22 op fi
1061 b3c57ab2 2022-03-22 op test_done $testroot $ret
1062 b3c57ab2 2022-03-22 op }
1063 b3c57ab2 2022-03-22 op
1064 9d6cabd5 2022-04-07 op test_patch_strip() {
1065 9d6cabd5 2022-04-07 op local testroot=`test_init patch_strip`
1066 9d6cabd5 2022-04-07 op
1067 9d6cabd5 2022-04-07 op got checkout $testroot/repo $testroot/wt > /dev/null
1068 9d6cabd5 2022-04-07 op ret=$?
1069 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1070 9d6cabd5 2022-04-07 op test_done $testroot $ret
1071 9d6cabd5 2022-04-07 op return 1
1072 9d6cabd5 2022-04-07 op fi
1073 9d6cabd5 2022-04-07 op
1074 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/wt/patch
1075 9d6cabd5 2022-04-07 op --- foo/bar/alpha.orig
1076 9d6cabd5 2022-04-07 op +++ foo/bar/alpha
1077 9d6cabd5 2022-04-07 op @@ -1 +1 @@
1078 9d6cabd5 2022-04-07 op -alpha
1079 9d6cabd5 2022-04-07 op +ALPHA
1080 9d6cabd5 2022-04-07 op EOF
1081 9d6cabd5 2022-04-07 op
1082 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p2 patch) > $testroot/stdout
1083 9d6cabd5 2022-04-07 op ret=$?
1084 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1085 9d6cabd5 2022-04-07 op test_done $testroot $ret
1086 9d6cabd5 2022-04-07 op return 1
1087 9d6cabd5 2022-04-07 op fi
1088 9d6cabd5 2022-04-07 op
1089 9d6cabd5 2022-04-07 op echo "M alpha" >> $testroot/stdout.expected
1090 9d6cabd5 2022-04-07 op cmp -s $testroot/stdout.expected $testroot/stdout
1091 9d6cabd5 2022-04-07 op ret=$?
1092 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1093 9d6cabd5 2022-04-07 op diff -u $testroot/stdout.expected $testroot/stdout
1094 9d6cabd5 2022-04-07 op test_done $testroot $ret
1095 9d6cabd5 2022-04-07 op return 1
1096 9d6cabd5 2022-04-07 op fi
1097 9d6cabd5 2022-04-07 op
1098 9d6cabd5 2022-04-07 op (cd $testroot/wt && got revert alpha) > /dev/null 2>&1
1099 9d6cabd5 2022-04-07 op ret=$?
1100 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1101 9d6cabd5 2022-04-07 op test_done $testroot $ret
1102 9d6cabd5 2022-04-07 op return 1
1103 9d6cabd5 2022-04-07 op fi
1104 9d6cabd5 2022-04-07 op
1105 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p3 patch) \
1106 9d6cabd5 2022-04-07 op 2> $testroot/stderr
1107 9d6cabd5 2022-04-07 op ret=$?
1108 9d6cabd5 2022-04-07 op if [ $ret -eq 0 ]; then
1109 9d6cabd5 2022-04-07 op echo "stripped more components than available!"
1110 9d6cabd5 2022-04-07 op test_done $testroot 1
1111 9d6cabd5 2022-04-07 op return 1
1112 9d6cabd5 2022-04-07 op fi
1113 9d6cabd5 2022-04-07 op
1114 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/stderr.expected
1115 9d6cabd5 2022-04-07 op got: can't strip 1 path-components from foo/bar/alpha: bad path
1116 9d6cabd5 2022-04-07 op EOF
1117 9d6cabd5 2022-04-07 op
1118 9d6cabd5 2022-04-07 op cmp -s $testroot/stderr.expected $testroot/stderr
1119 9d6cabd5 2022-04-07 op ret=$?
1120 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1121 9d6cabd5 2022-04-07 op diff -u $testroot/stderr.expected $testroot/stderr
1122 9d6cabd5 2022-04-07 op fi
1123 9d6cabd5 2022-04-07 op test_done $testroot 0
1124 a92a2042 2022-07-02 op }
1125 a92a2042 2022-07-02 op
1126 a92a2042 2022-07-02 op test_patch_whitespace() {
1127 a92a2042 2022-07-02 op local testroot=`test_init patch_whitespace`
1128 a92a2042 2022-07-02 op
1129 a92a2042 2022-07-02 op got checkout $testroot/repo $testroot/wt > /dev/null
1130 a92a2042 2022-07-02 op ret=$?
1131 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1132 a92a2042 2022-07-02 op test_done $testroot $ret
1133 a92a2042 2022-07-02 op return 1
1134 a92a2042 2022-07-02 op fi
1135 a92a2042 2022-07-02 op
1136 a92a2042 2022-07-02 op trailing=" "
1137 a92a2042 2022-07-02 op
1138 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c
1139 a92a2042 2022-07-02 op #include <stdio.h>
1140 a92a2042 2022-07-02 op
1141 a92a2042 2022-07-02 op int
1142 a92a2042 2022-07-02 op main(void)
1143 a92a2042 2022-07-02 op {
1144 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1145 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1146 a92a2042 2022-07-02 op return 0;
1147 a92a2042 2022-07-02 op }
1148 a92a2042 2022-07-02 op EOF
1149 a92a2042 2022-07-02 op
1150 a92a2042 2022-07-02 op (cd $testroot/wt && got add hello.c && got ci -m '+hello.c') \
1151 a92a2042 2022-07-02 op > /dev/null
1152 a92a2042 2022-07-02 op ret=$?
1153 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1154 a92a2042 2022-07-02 op test_done $testroot $ret
1155 a92a2042 2022-07-02 op return 1
1156 a92a2042 2022-07-02 op fi
1157 a92a2042 2022-07-02 op
1158 a92a2042 2022-07-02 op # test with a diff with various whitespace corruptions
1159 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/patch
1160 a92a2042 2022-07-02 op --- hello.c
1161 a92a2042 2022-07-02 op +++ hello.c
1162 a92a2042 2022-07-02 op @@ -5,5 +5,5 @@
1163 a92a2042 2022-07-02 op {
1164 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1165 a92a2042 2022-07-02 op printf("hello, world\n");
1166 a92a2042 2022-07-02 op - return 0;
1167 a92a2042 2022-07-02 op + return 5; /* always fails */
1168 a92a2042 2022-07-02 op }
1169 a92a2042 2022-07-02 op EOF
1170 a92a2042 2022-07-02 op
1171 a92a2042 2022-07-02 op (cd $testroot/wt && got patch patch) \
1172 a92a2042 2022-07-02 op 2>$testroot/stderr >$testroot/stdout
1173 a92a2042 2022-07-02 op ret=$?
1174 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1175 a92a2042 2022-07-02 op echo "failed to apply diff" >&2
1176 a92a2042 2022-07-02 op test_done $testroot $ret
1177 a92a2042 2022-07-02 op return 1
1178 a92a2042 2022-07-02 op fi
1179 a92a2042 2022-07-02 op
1180 a92a2042 2022-07-02 op echo 'M hello.c' > $testroot/stdout.expected
1181 a92a2042 2022-07-02 op echo '@@ -5,5 +5,5 @@ hunk contains mangled whitespace' \
1182 a92a2042 2022-07-02 op >> $testroot/stdout.expected
1183 a92a2042 2022-07-02 op cmp -s $testroot/stdout.expected $testroot/stdout
1184 a92a2042 2022-07-02 op ret=$?
1185 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1186 a92a2042 2022-07-02 op diff -u $testroot/stdout.expected $testroot/stdout
1187 a92a2042 2022-07-02 op test_done $testroot $ret
1188 a92a2042 2022-07-02 op return 1
1189 a92a2042 2022-07-02 op fi
1190 a92a2042 2022-07-02 op
1191 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c.expected
1192 a92a2042 2022-07-02 op #include <stdio.h>
1193 a92a2042 2022-07-02 op
1194 a92a2042 2022-07-02 op int
1195 a92a2042 2022-07-02 op main(void)
1196 a92a2042 2022-07-02 op {
1197 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1198 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1199 a92a2042 2022-07-02 op return 5; /* always fails */
1200 a92a2042 2022-07-02 op }
1201 a92a2042 2022-07-02 op EOF
1202 a92a2042 2022-07-02 op
1203 a92a2042 2022-07-02 op cmp -s $testroot/wt/hello.c.expected $testroot/wt/hello.c
1204 a92a2042 2022-07-02 op ret=$?
1205 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1206 a92a2042 2022-07-02 op diff -u $testroot/wt/hello.c.expected $testroot/wt/hello.c
1207 a92a2042 2022-07-02 op fi
1208 a92a2042 2022-07-02 op test_done $testroot $ret
1209 9d6cabd5 2022-04-07 op }
1210 ed3bff83 2022-04-23 op
1211 ed3bff83 2022-04-23 op test_patch_relative_paths() {
1212 f1d6cebb 2022-04-23 op local testroot=`test_init patch_relative_paths`
1213 ed3bff83 2022-04-23 op
1214 ed3bff83 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1215 ed3bff83 2022-04-23 op ret=$?
1216 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1217 ed3bff83 2022-04-23 op test_done $testroot $ret
1218 ed3bff83 2022-04-23 op return 1
1219 ed3bff83 2022-04-23 op fi
1220 9d6cabd5 2022-04-07 op
1221 ed3bff83 2022-04-23 op cat <<EOF > $testroot/wt/gamma/patch
1222 ed3bff83 2022-04-23 op --- delta
1223 ed3bff83 2022-04-23 op +++ delta
1224 ed3bff83 2022-04-23 op @@ -1 +1 @@
1225 ed3bff83 2022-04-23 op -delta
1226 ed3bff83 2022-04-23 op +DELTA
1227 ed3bff83 2022-04-23 op --- /dev/null
1228 ed3bff83 2022-04-23 op +++ eta
1229 ed3bff83 2022-04-23 op @@ -0,0 +1 @@
1230 ed3bff83 2022-04-23 op +eta
1231 ed3bff83 2022-04-23 op EOF
1232 ed3bff83 2022-04-23 op
1233 ed3bff83 2022-04-23 op (cd $testroot/wt/gamma && got patch patch) > $testroot/stdout
1234 ed3bff83 2022-04-23 op ret=$?
1235 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1236 ed3bff83 2022-04-23 op test_done $testroot $ret
1237 ed3bff83 2022-04-23 op return 1
1238 ed3bff83 2022-04-23 op fi
1239 ed3bff83 2022-04-23 op
1240 ed3bff83 2022-04-23 op echo 'M gamma/delta' > $testroot/stdout.expected
1241 ed3bff83 2022-04-23 op echo 'A gamma/eta' >> $testroot/stdout.expected
1242 15e1bda6 2022-04-23 op
1243 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1244 15e1bda6 2022-04-23 op ret=$?
1245 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1246 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1247 15e1bda6 2022-04-23 op fi
1248 15e1bda6 2022-04-23 op test_done $testroot $ret
1249 15e1bda6 2022-04-23 op }
1250 15e1bda6 2022-04-23 op
1251 15e1bda6 2022-04-23 op test_patch_with_path_prefix() {
1252 15e1bda6 2022-04-23 op local testroot=`test_init patch_with_path_prefix`
1253 15e1bda6 2022-04-23 op
1254 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1255 15e1bda6 2022-04-23 op ret=$?
1256 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1257 15e1bda6 2022-04-23 op test_done $testroot $ret
1258 15e1bda6 2022-04-23 op return 1
1259 15e1bda6 2022-04-23 op fi
1260 15e1bda6 2022-04-23 op
1261 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1262 15e1bda6 2022-04-23 op --- delta
1263 15e1bda6 2022-04-23 op +++ delta
1264 15e1bda6 2022-04-23 op @@ -1 +1 @@
1265 15e1bda6 2022-04-23 op -delta
1266 15e1bda6 2022-04-23 op +DELTA
1267 15e1bda6 2022-04-23 op --- /dev/null
1268 15e1bda6 2022-04-23 op +++ eta
1269 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1270 15e1bda6 2022-04-23 op +eta
1271 15e1bda6 2022-04-23 op EOF
1272 15e1bda6 2022-04-23 op
1273 15e1bda6 2022-04-23 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1274 15e1bda6 2022-04-23 op ret=$?
1275 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1276 15e1bda6 2022-04-23 op test_done $testroot $ret
1277 15e1bda6 2022-04-23 op return 1
1278 15e1bda6 2022-04-23 op fi
1279 15e1bda6 2022-04-23 op
1280 15e1bda6 2022-04-23 op echo 'M delta' > $testroot/stdout.expected
1281 15e1bda6 2022-04-23 op echo 'A eta' >> $testroot/stdout.expected
1282 15e1bda6 2022-04-23 op
1283 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1284 15e1bda6 2022-04-23 op ret=$?
1285 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1286 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1287 15e1bda6 2022-04-23 op fi
1288 15e1bda6 2022-04-23 op test_done $testroot $ret
1289 15e1bda6 2022-04-23 op }
1290 ed3bff83 2022-04-23 op
1291 15e1bda6 2022-04-23 op test_patch_relpath_with_path_prefix() {
1292 15e1bda6 2022-04-23 op local testroot=`test_init patch_relpaths_with_path_prefix`
1293 15e1bda6 2022-04-23 op
1294 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1295 15e1bda6 2022-04-23 op ret=$?
1296 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1297 15e1bda6 2022-04-23 op test_done $testroot $ret
1298 15e1bda6 2022-04-23 op return 1
1299 15e1bda6 2022-04-23 op fi
1300 15e1bda6 2022-04-23 op
1301 15e1bda6 2022-04-23 op mkdir -p $testroot/wt/epsilon/zeta/
1302 15e1bda6 2022-04-23 op
1303 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1304 15e1bda6 2022-04-23 op --- /dev/null
1305 15e1bda6 2022-04-23 op +++ zeta/theta
1306 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1307 15e1bda6 2022-04-23 op +theta
1308 15e1bda6 2022-04-23 op EOF
1309 15e1bda6 2022-04-23 op
1310 15e1bda6 2022-04-23 op (cd $testroot/wt/epsilon/zeta && got patch -p1 $testroot/wt/patch) \
1311 15e1bda6 2022-04-23 op > $testroot/stdout
1312 15e1bda6 2022-04-23 op ret=$?
1313 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1314 15e1bda6 2022-04-23 op test_done $testroot $ret
1315 15e1bda6 2022-04-23 op return 1
1316 15e1bda6 2022-04-23 op fi
1317 15e1bda6 2022-04-23 op
1318 15e1bda6 2022-04-23 op echo 'A epsilon/zeta/theta' >> $testroot/stdout.expected
1319 15e1bda6 2022-04-23 op
1320 ed3bff83 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1321 ed3bff83 2022-04-23 op ret=$?
1322 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1323 ed3bff83 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1324 15e1bda6 2022-04-23 op test_done $testroot $ret
1325 15e1bda6 2022-04-23 op return 1
1326 ed3bff83 2022-04-23 op fi
1327 15e1bda6 2022-04-23 op
1328 15e1bda6 2022-04-23 op echo 'theta' > $testroot/theta.expected
1329 15e1bda6 2022-04-23 op cmp -s $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1330 15e1bda6 2022-04-23 op ret=$?
1331 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1332 15e1bda6 2022-04-23 op diff -u $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1333 15e1bda6 2022-04-23 op fi
1334 ed3bff83 2022-04-23 op test_done $testroot $ret
1335 ed3bff83 2022-04-23 op }
1336 bad961bf 2022-04-23 op
1337 bad961bf 2022-04-23 op test_patch_reverse() {
1338 bad961bf 2022-04-23 op local testroot=`test_init patch_reverse`
1339 bad961bf 2022-04-23 op
1340 bad961bf 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1341 bad961bf 2022-04-23 op ret=$?
1342 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1343 bad961bf 2022-04-23 op test_done $testroot $ret
1344 bad961bf 2022-04-23 op return 1
1345 bad961bf 2022-04-23 op fi
1346 bad961bf 2022-04-23 op
1347 bad961bf 2022-04-23 op cat <<EOF > $testroot/wt/patch
1348 bad961bf 2022-04-23 op --- alpha
1349 bad961bf 2022-04-23 op +++ alpha
1350 bad961bf 2022-04-23 op @@ -1 +1 @@
1351 bad961bf 2022-04-23 op -ALPHA
1352 bad961bf 2022-04-23 op \ No newline at end of file
1353 bad961bf 2022-04-23 op +alpha
1354 bad961bf 2022-04-23 op EOF
1355 ed3bff83 2022-04-23 op
1356 bad961bf 2022-04-23 op (cd $testroot/wt && got patch -R patch) > $testroot/stdout
1357 bad961bf 2022-04-23 op ret=$?
1358 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1359 bad961bf 2022-04-23 op test_done $testroot $ret
1360 bad961bf 2022-04-23 op return 1
1361 bad961bf 2022-04-23 op fi
1362 bad961bf 2022-04-23 op
1363 bad961bf 2022-04-23 op echo "M alpha" > $testroot/stdout.expected
1364 bad961bf 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1365 bad961bf 2022-04-23 op ret=$?
1366 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1367 bad961bf 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1368 bad961bf 2022-04-23 op test_done $testroot $ret
1369 bad961bf 2022-04-23 op return 1
1370 bad961bf 2022-04-23 op fi
1371 bad961bf 2022-04-23 op
1372 bad961bf 2022-04-23 op echo -n ALPHA > $testroot/wt/alpha.expected
1373 bad961bf 2022-04-23 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
1374 bad961bf 2022-04-23 op ret=$?
1375 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1376 bad961bf 2022-04-23 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
1377 55e9459f 2022-06-19 op fi
1378 55e9459f 2022-06-19 op test_done $testroot $ret
1379 55e9459f 2022-06-19 op }
1380 55e9459f 2022-06-19 op
1381 55e9459f 2022-06-19 op test_patch_merge_simple() {
1382 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_simple`
1383 55e9459f 2022-06-19 op
1384 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1385 55e9459f 2022-06-19 op ret=$?
1386 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1387 55e9459f 2022-06-19 op test_done $testroot $ret
1388 55e9459f 2022-06-19 op return 1
1389 55e9459f 2022-06-19 op fi
1390 55e9459f 2022-06-19 op
1391 2fed5287 2024-04-09 op seq 10 > $testroot/wt/numbers
1392 5dffb1a1 2022-07-02 op chmod +x $testroot/wt/numbers
1393 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1394 55e9459f 2022-06-19 op > /dev/null
1395 55e9459f 2022-06-19 op ret=$?
1396 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1397 55e9459f 2022-06-19 op test_done $testroot $ret
1398 55e9459f 2022-06-19 op return 1
1399 55e9459f 2022-06-19 op fi
1400 55e9459f 2022-06-19 op
1401 2fed5287 2024-04-09 op seq 10 | sed 's/4/four/g' > $testroot/wt/numbers
1402 55e9459f 2022-06-19 op
1403 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1404 55e9459f 2022-06-19 op && got revert numbers) >/dev/null
1405 55e9459f 2022-06-19 op ret=$?
1406 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1407 55e9459f 2022-06-19 op test_done $testroot $ret
1408 55e9459f 2022-06-19 op return 1
1409 55e9459f 2022-06-19 op fi
1410 55e9459f 2022-06-19 op
1411 2fed5287 2024-04-09 op seq 10 | sed 's/6/six/g' > $testroot/wt/numbers
1412 55e9459f 2022-06-19 op (cd $testroot/wt && got commit -m 'edit numbers') \
1413 55e9459f 2022-06-19 op > /dev/null
1414 55e9459f 2022-06-19 op ret=$?
1415 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1416 55e9459f 2022-06-19 op test_done $testroot $ret
1417 55e9459f 2022-06-19 op return 1
1418 55e9459f 2022-06-19 op fi
1419 55e9459f 2022-06-19 op
1420 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1421 9802c41c 2022-06-21 op > $testroot/stdout
1422 55e9459f 2022-06-19 op ret=$?
1423 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1424 9802c41c 2022-06-21 op test_done $testroot $ret
1425 9802c41c 2022-06-21 op return 1
1426 9802c41c 2022-06-21 op fi
1427 9802c41c 2022-06-21 op
1428 9802c41c 2022-06-21 op echo 'G numbers' > $testroot/stdout.expected
1429 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1430 9802c41c 2022-06-21 op ret=$?
1431 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1432 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1433 55e9459f 2022-06-19 op test_done $testroot $ret
1434 55e9459f 2022-06-19 op return 1
1435 55e9459f 2022-06-19 op fi
1436 55e9459f 2022-06-19 op
1437 2fed5287 2024-04-09 op seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1438 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1439 55e9459f 2022-06-19 op ret=$?
1440 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1441 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1442 5dffb1a1 2022-07-02 op test_done $testroot $ret
1443 5dffb1a1 2022-07-02 op return 1
1444 db0dfdd7 2022-06-27 op fi
1445 5dffb1a1 2022-07-02 op
1446 5dffb1a1 2022-07-02 op test -x $testroot/wt/numbers
1447 5dffb1a1 2022-07-02 op ret=$?
1448 5dffb1a1 2022-07-02 op if [ $ret -ne 0 ]; then
1449 5dffb1a1 2022-07-02 op echo "numbers lost the executable bit" >&2
1450 5dffb1a1 2022-07-02 op fi
1451 db0dfdd7 2022-06-27 op test_done $testroot $ret
1452 db0dfdd7 2022-06-27 op }
1453 db0dfdd7 2022-06-27 op
1454 db0dfdd7 2022-06-27 op test_patch_merge_gitdiff() {
1455 db0dfdd7 2022-06-27 op local testroot=`test_init patch_merge_gitdiff`
1456 db0dfdd7 2022-06-27 op
1457 2fed5287 2024-04-09 op seq 10 > $testroot/repo/numbers
1458 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers && \
1459 f73bf5bd 2023-10-01 naddy git_commit $testroot/repo -m "nums"
1460 db0dfdd7 2022-06-27 op ret=$?
1461 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1462 db0dfdd7 2022-06-27 op test_done $testroot $ret
1463 db0dfdd7 2022-06-27 op return 1
1464 db0dfdd7 2022-06-27 op fi
1465 db0dfdd7 2022-06-27 op
1466 2fed5287 2024-04-09 op seq 10 | sed 's/4/four/g' > $testroot/repo/numbers
1467 f73bf5bd 2023-10-01 naddy git -C $testroot/repo diff > $testroot/old.diff
1468 db0dfdd7 2022-06-27 op ret=$?
1469 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1470 db0dfdd7 2022-06-27 op test_done $testroot $ret
1471 db0dfdd7 2022-06-27 op return 1
1472 db0dfdd7 2022-06-27 op fi
1473 db0dfdd7 2022-06-27 op
1474 db0dfdd7 2022-06-27 op # restore numbers
1475 2fed5287 2024-04-09 op seq 10 > $testroot/repo/numbers
1476 db0dfdd7 2022-06-27 op
1477 2fed5287 2024-04-09 op seq 10 | sed 's/6/six/g' > $testroot/repo/numbers
1478 f73bf5bd 2023-10-01 naddy git -C $testroot/repo add numbers && \
1479 f73bf5bd 2023-10-01 naddy git_commit $testroot/repo -m "edit"
1480 db0dfdd7 2022-06-27 op ret=$?
1481 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1482 db0dfdd7 2022-06-27 op test_done $testroot $ret
1483 db0dfdd7 2022-06-27 op return 1
1484 db0dfdd7 2022-06-27 op fi
1485 db0dfdd7 2022-06-27 op
1486 db0dfdd7 2022-06-27 op # now work with got:
1487 db0dfdd7 2022-06-27 op got checkout $testroot/repo $testroot/wt > /dev/null
1488 db0dfdd7 2022-06-27 op ret=$?
1489 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1490 db0dfdd7 2022-06-27 op test_done $testroot $ret
1491 db0dfdd7 2022-06-27 op return 1
1492 db0dfdd7 2022-06-27 op fi
1493 db0dfdd7 2022-06-27 op
1494 db0dfdd7 2022-06-27 op (cd $testroot/wt && got patch $testroot/old.diff) > $testroot/stdout
1495 db0dfdd7 2022-06-27 op ret=$?
1496 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1497 db0dfdd7 2022-06-27 op test_done $testroot $ret
1498 db0dfdd7 2022-06-27 op return 1
1499 55e9459f 2022-06-19 op fi
1500 db0dfdd7 2022-06-27 op
1501 db0dfdd7 2022-06-27 op echo 'G numbers' > $testroot/stdout.expected
1502 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout $testroot/stdout.expected
1503 db0dfdd7 2022-06-27 op ret=$?
1504 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1505 db0dfdd7 2022-06-27 op diff -u $testroot/stdout $testroot/stdout.expected
1506 db0dfdd7 2022-06-27 op fi
1507 55e9459f 2022-06-19 op test_done $testroot $ret
1508 55e9459f 2022-06-19 op }
1509 5f56d41e 2022-07-28 op
1510 5f56d41e 2022-07-28 op test_patch_merge_base_provided() {
1511 5f56d41e 2022-07-28 op local testroot=`test_init patch_merge_base_provided`
1512 5f56d41e 2022-07-28 op
1513 5f56d41e 2022-07-28 op got checkout $testroot/repo $testroot/wt >/dev/null
1514 5f56d41e 2022-07-28 op ret=$?
1515 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1516 5f56d41e 2022-07-28 op test_done $testroot $ret
1517 5f56d41e 2022-07-28 op return 1
1518 5f56d41e 2022-07-28 op fi
1519 5f56d41e 2022-07-28 op
1520 2fed5287 2024-04-09 op seq 10 > $testroot/wt/numbers
1521 5f56d41e 2022-07-28 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1522 5f56d41e 2022-07-28 op >/dev/null
1523 5f56d41e 2022-07-28 op ret=$?
1524 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1525 5f56d41e 2022-07-28 op test_done $testroot $ret
1526 5f56d41e 2022-07-28 op return 1
1527 5f56d41e 2022-07-28 op fi
1528 55e9459f 2022-06-19 op
1529 5f56d41e 2022-07-28 op local commit_id=`git_show_head $testroot/repo`
1530 5f56d41e 2022-07-28 op
1531 2fed5287 2024-04-09 op seq 10 | sed s/4/four/ > $testroot/wt/numbers
1532 5f56d41e 2022-07-28 op
1533 5f56d41e 2022-07-28 op # get rid of the metadata
1534 5f56d41e 2022-07-28 op (cd $testroot/wt && got diff | sed -n '/^---/,$p' > patch) \
1535 5f56d41e 2022-07-28 op >/dev/null
1536 5f56d41e 2022-07-28 op
1537 2fed5287 2024-04-09 op seq 10 | sed s/6/six/ > $testroot/wt/numbers
1538 5f56d41e 2022-07-28 op (cd $testroot/wt && got commit -m 'edit numbers') >/dev/null
1539 5f56d41e 2022-07-28 op ret=$?
1540 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1541 5f56d41e 2022-07-28 op test_done $testroot $ret
1542 5f56d41e 2022-07-28 op return 1
1543 5f56d41e 2022-07-28 op fi
1544 5f56d41e 2022-07-28 op
1545 5f56d41e 2022-07-28 op (cd $testroot/wt && got patch -c $commit_id patch) >$testroot/stdout
1546 5f56d41e 2022-07-28 op ret=$?
1547 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1548 5f56d41e 2022-07-28 op test_done $testroot $ret
1549 5f56d41e 2022-07-28 op return 1
1550 5f56d41e 2022-07-28 op fi
1551 5f56d41e 2022-07-28 op
1552 5f56d41e 2022-07-28 op echo 'G numbers' > $testroot/stdout.expected
1553 5f56d41e 2022-07-28 op cmp -s $testroot/stdout $testroot/stdout.expected
1554 5f56d41e 2022-07-28 op ret=$?
1555 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1556 5f56d41e 2022-07-28 op diff -u $testroot/stdout $testroot/stdout.expected
1557 5f56d41e 2022-07-28 op test_done $testroot $ret
1558 5f56d41e 2022-07-28 op return 1
1559 5f56d41e 2022-07-28 op fi
1560 5f56d41e 2022-07-28 op
1561 2fed5287 2024-04-09 op seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1562 5f56d41e 2022-07-28 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1563 5f56d41e 2022-07-28 op ret=$?
1564 5f56d41e 2022-07-28 op if [ $ret -ne 0 ]; then
1565 5f56d41e 2022-07-28 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1566 5f56d41e 2022-07-28 op fi
1567 5f56d41e 2022-07-28 op test_done $testroot $ret
1568 5f56d41e 2022-07-28 op }
1569 5f56d41e 2022-07-28 op
1570 55e9459f 2022-06-19 op test_patch_merge_conflict() {
1571 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_conflict`
1572 55e9459f 2022-06-19 op
1573 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1574 55e9459f 2022-06-19 op ret=$?
1575 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1576 55e9459f 2022-06-19 op test_done $testroot $ret
1577 55e9459f 2022-06-19 op return 1
1578 55e9459f 2022-06-19 op fi
1579 55e9459f 2022-06-19 op
1580 2fed5287 2024-04-09 op seq 10 > $testroot/wt/numbers
1581 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1582 55e9459f 2022-06-19 op > /dev/null
1583 55e9459f 2022-06-19 op ret=$?
1584 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1585 55e9459f 2022-06-19 op test_done $testroot $ret
1586 55e9459f 2022-06-19 op return 1
1587 55e9459f 2022-06-19 op fi
1588 d8b5af43 2022-06-19 op
1589 d8b5af43 2022-06-19 op local commit_id=`git_show_head $testroot/repo`
1590 55e9459f 2022-06-19 op
1591 2fed5287 2024-04-09 op seq 10 | sed 's/6/six/g' > $testroot/wt/numbers
1592 acf749fc 2022-07-02 op echo ALPHA > $testroot/wt/alpha
1593 55e9459f 2022-06-19 op
1594 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1595 acf749fc 2022-07-02 op && got revert alpha numbers) >/dev/null
1596 55e9459f 2022-06-19 op ret=$?
1597 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1598 55e9459f 2022-06-19 op test_done $testroot $ret
1599 55e9459f 2022-06-19 op return 1
1600 55e9459f 2022-06-19 op fi
1601 55e9459f 2022-06-19 op
1602 2fed5287 2024-04-09 op seq 10 | sed 's/6/3+3/g' > $testroot/wt/numbers
1603 2fed5287 2024-04-09 op printf '%s\n' a b c > $testroot/wt/alpha
1604 acf749fc 2022-07-02 op (cd $testroot/wt && got commit -m 'edit alpha and numbers') \
1605 55e9459f 2022-06-19 op > /dev/null
1606 55e9459f 2022-06-19 op ret=$?
1607 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1608 55e9459f 2022-06-19 op test_done $testroot $ret
1609 55e9459f 2022-06-19 op return 1
1610 bad961bf 2022-04-23 op fi
1611 55e9459f 2022-06-19 op
1612 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1613 9802c41c 2022-06-21 op > $testroot/stdout 2>/dev/null
1614 55e9459f 2022-06-19 op ret=$?
1615 55e9459f 2022-06-19 op if [ $ret -eq 0 ]; then
1616 55e9459f 2022-06-19 op echo "got patch merged a diff that should conflict" >&2
1617 e423877d 2023-05-11 stsp test_done $testroot 1
1618 55e9459f 2022-06-19 op return 1
1619 55e9459f 2022-06-19 op fi
1620 55e9459f 2022-06-19 op
1621 acf749fc 2022-07-02 op echo 'C alpha' > $testroot/stdout.expected
1622 acf749fc 2022-07-02 op echo 'C numbers' >> $testroot/stdout.expected
1623 bfcdc9e9 2023-05-11 stsp echo 'Files with merge conflicts: 2' >> $testroot/stdout.expected
1624 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1625 9802c41c 2022-06-21 op ret=$?
1626 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1627 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1628 9802c41c 2022-06-21 op test_done $testroot $ret
1629 9802c41c 2022-06-21 op return 1
1630 9802c41c 2022-06-21 op fi
1631 9802c41c 2022-06-21 op
1632 55e9459f 2022-06-19 op # XXX: prefixing every line with a tab otherwise got thinks
1633 55e9459f 2022-06-19 op # the file has conflicts in it.
1634 acf749fc 2022-07-02 op cat <<-EOF > $testroot/wt/alpha.expected
1635 acf749fc 2022-07-02 op <<<<<<< --- alpha
1636 acf749fc 2022-07-02 op ALPHA
1637 acf749fc 2022-07-02 op ||||||| commit $commit_id
1638 acf749fc 2022-07-02 op alpha
1639 acf749fc 2022-07-02 op =======
1640 acf749fc 2022-07-02 op a
1641 acf749fc 2022-07-02 op b
1642 acf749fc 2022-07-02 op c
1643 acf749fc 2022-07-02 op >>>>>>> +++ alpha
1644 acf749fc 2022-07-02 op EOF
1645 acf749fc 2022-07-02 op
1646 55e9459f 2022-06-19 op cat <<-EOF > $testroot/wt/numbers.expected
1647 55e9459f 2022-06-19 op 1
1648 55e9459f 2022-06-19 op 2
1649 55e9459f 2022-06-19 op 3
1650 55e9459f 2022-06-19 op 4
1651 55e9459f 2022-06-19 op 5
1652 55e9459f 2022-06-19 op <<<<<<< --- numbers
1653 55e9459f 2022-06-19 op six
1654 d8b5af43 2022-06-19 op ||||||| commit $commit_id
1655 55e9459f 2022-06-19 op 6
1656 55e9459f 2022-06-19 op =======
1657 55e9459f 2022-06-19 op 3+3
1658 55e9459f 2022-06-19 op >>>>>>> +++ numbers
1659 55e9459f 2022-06-19 op 7
1660 55e9459f 2022-06-19 op 8
1661 55e9459f 2022-06-19 op 9
1662 55e9459f 2022-06-19 op 10
1663 55e9459f 2022-06-19 op EOF
1664 55e9459f 2022-06-19 op
1665 acf749fc 2022-07-02 op cmp -s $testroot/wt/alpha $testroot/wt/alpha.expected
1666 acf749fc 2022-07-02 op ret=$?
1667 acf749fc 2022-07-02 op if [ $ret -ne 0 ]; then
1668 acf749fc 2022-07-02 op diff -u $testroot/wt/alpha $testroot/wt/alpha.expected
1669 acf749fc 2022-07-02 op test_done $testroot $ret
1670 acf749fc 2022-07-02 op return 1
1671 acf749fc 2022-07-02 op fi
1672 acf749fc 2022-07-02 op
1673 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1674 55e9459f 2022-06-19 op ret=$?
1675 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1676 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1677 55e9459f 2022-06-19 op fi
1678 bad961bf 2022-04-23 op test_done $testroot $ret
1679 bad961bf 2022-04-23 op }
1680 bad961bf 2022-04-23 op
1681 55e9459f 2022-06-19 op test_patch_merge_unknown_blob() {
1682 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_unknown_blob`
1683 55e9459f 2022-06-19 op
1684 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1685 55e9459f 2022-06-19 op ret=$?
1686 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1687 55e9459f 2022-06-19 op test_done $testroot $ret
1688 55e9459f 2022-06-19 op return 1
1689 55e9459f 2022-06-19 op fi
1690 55e9459f 2022-06-19 op
1691 55e9459f 2022-06-19 op cat <<EOF > $testroot/wt/patch
1692 55e9459f 2022-06-19 op I've got a
1693 dbc68eed 2022-06-21 op diff aaaabbbbccccddddeeeeffff0000111122223333 foo/bar
1694 dbc68eed 2022-06-21 op with a
1695 55e9459f 2022-06-19 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1696 55e9459f 2022-06-19 op and also a
1697 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1698 55e9459f 2022-06-19 op for this dummy diff
1699 55e9459f 2022-06-19 op --- alpha
1700 55e9459f 2022-06-19 op +++ alpha
1701 55e9459f 2022-06-19 op @@ -1 +1 @@
1702 55e9459f 2022-06-19 op -alpha
1703 55e9459f 2022-06-19 op +ALPHA
1704 55e9459f 2022-06-19 op will it work?
1705 55e9459f 2022-06-19 op EOF
1706 55e9459f 2022-06-19 op
1707 55e9459f 2022-06-19 op (cd $testroot/wt/ && got patch patch) > $testroot/stdout
1708 55e9459f 2022-06-19 op ret=$?
1709 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1710 55e9459f 2022-06-19 op test_done $testroot $ret
1711 55e9459f 2022-06-19 op return 1
1712 55e9459f 2022-06-19 op fi
1713 55e9459f 2022-06-19 op
1714 55e9459f 2022-06-19 op echo 'M alpha' > $testroot/stdout.expected
1715 55e9459f 2022-06-19 op cmp -s $testroot/stdout.expected $testroot/stdout
1716 55e9459f 2022-06-19 op ret=$?
1717 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1718 55e9459f 2022-06-19 op diff -u $testroot/stdout.expected $testroot/stdout
1719 dbc68eed 2022-06-21 op test_done $testroot $ret
1720 dbc68eed 2022-06-21 op return 1
1721 55e9459f 2022-06-19 op fi
1722 dbc68eed 2022-06-21 op
1723 dbc68eed 2022-06-21 op # try again without a `diff' header
1724 dbc68eed 2022-06-21 op
1725 dbc68eed 2022-06-21 op cat <<EOF > $testroot/wt/patch
1726 dbc68eed 2022-06-21 op I've got a
1727 dbc68eed 2022-06-21 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1728 dbc68eed 2022-06-21 op and also a
1729 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1730 dbc68eed 2022-06-21 op for this dummy diff
1731 dbc68eed 2022-06-21 op --- alpha
1732 dbc68eed 2022-06-21 op +++ alpha
1733 dbc68eed 2022-06-21 op @@ -1 +1 @@
1734 dbc68eed 2022-06-21 op -alpha
1735 dbc68eed 2022-06-21 op +ALPHA
1736 dbc68eed 2022-06-21 op will it work?
1737 dbc68eed 2022-06-21 op EOF
1738 dbc68eed 2022-06-21 op
1739 dbc68eed 2022-06-21 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1740 dbc68eed 2022-06-21 op > $testroot/stdout
1741 dbc68eed 2022-06-21 op ret=$?
1742 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1743 dbc68eed 2022-06-21 op test_done $testroot $ret
1744 dbc68eed 2022-06-21 op return 1
1745 dbc68eed 2022-06-21 op fi
1746 dbc68eed 2022-06-21 op
1747 dbc68eed 2022-06-21 op echo 'M alpha' > $testroot/stdout.expected
1748 dbc68eed 2022-06-21 op cmp -s $testroot/stdout.expected $testroot/stdout
1749 dbc68eed 2022-06-21 op ret=$?
1750 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1751 dbc68eed 2022-06-21 op diff -u $testroot/stdout.expected $testroot/stdout
1752 db0dfdd7 2022-06-27 op test_done $testroot $ret
1753 db0dfdd7 2022-06-27 op return 1
1754 dbc68eed 2022-06-21 op fi
1755 db0dfdd7 2022-06-27 op
1756 db0dfdd7 2022-06-27 op # try again with a git-style diff
1757 db0dfdd7 2022-06-27 op
1758 db0dfdd7 2022-06-27 op cat <<EOF > $testroot/wt/patch
1759 db0dfdd7 2022-06-27 op diff --git a/alpha b/alpha
1760 db0dfdd7 2022-06-27 op index 0123456789ab..abcdef012345 100644
1761 db0dfdd7 2022-06-27 op --- a/alpha
1762 db0dfdd7 2022-06-27 op +++ b/alpha
1763 db0dfdd7 2022-06-27 op @@ -1 +1 @@
1764 db0dfdd7 2022-06-27 op -alpha
1765 db0dfdd7 2022-06-27 op +ALPHA
1766 db0dfdd7 2022-06-27 op EOF
1767 db0dfdd7 2022-06-27 op
1768 db0dfdd7 2022-06-27 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1769 db0dfdd7 2022-06-27 op > $testroot/stdout
1770 db0dfdd7 2022-06-27 op ret=$?
1771 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1772 db0dfdd7 2022-06-27 op test_done $testroot $ret
1773 db0dfdd7 2022-06-27 op return 1
1774 db0dfdd7 2022-06-27 op fi
1775 db0dfdd7 2022-06-27 op
1776 db0dfdd7 2022-06-27 op echo 'M alpha' > $testroot/stdout.expected
1777 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout.expected $testroot/stdout
1778 db0dfdd7 2022-06-27 op ret=$?
1779 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1780 db0dfdd7 2022-06-27 op diff -u $testroot/stdout.expected $testroot/stdout
1781 db0dfdd7 2022-06-27 op fi
1782 55e9459f 2022-06-19 op test_done $testroot $ret
1783 55e9459f 2022-06-19 op }
1784 38d61ead 2022-07-23 op
1785 38d61ead 2022-07-23 op test_patch_merge_reverse() {
1786 38d61ead 2022-07-23 op local testroot=`test_init patch_merge_simple`
1787 38d61ead 2022-07-23 op
1788 38d61ead 2022-07-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1789 38d61ead 2022-07-23 op ret=$?
1790 38d61ead 2022-07-23 op if [ $ret -ne 0 ]; then
1791 38d61ead 2022-07-23 op test_done $testroot $ret
1792 38d61ead 2022-07-23 op return 1
1793 38d61ead 2022-07-23 op fi
1794 55e9459f 2022-06-19 op
1795 2fed5287 2024-04-09 op seq 10 > $testroot/wt/numbers
1796 38d61ead 2022-07-23 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1797 38d61ead 2022-07-23 op > /dev/null
1798 38d61ead 2022-07-23 op ret=$?
1799 38d61ead 2022-07-23 op if [ $ret -ne 0 ]; then
1800 38d61ead 2022-07-23 op test_done $testroot $ret
1801 38d61ead 2022-07-23 op return 1
1802 38d61ead 2022-07-23 op fi
1803 38d61ead 2022-07-23 op
1804 38d61ead 2022-07-23 op local commit_id=`git_show_head $testroot/repo`
1805 38d61ead 2022-07-23 op
1806 2fed5287 2024-04-09 op seq 10 | sed s/5/five/g > $testroot/wt/numbers
1807 38d61ead 2022-07-23 op (cd $testroot/wt && got diff > $testroot/wt/patch \
1808 38d61ead 2022-07-23 op && got commit -m 'edit numbers') > /dev/null
1809 38d61ead 2022-07-23 op ret=$?
1810 38d61ead 2022-07-23 op if [ $ret -ne 0 ]; then
1811 38d61ead 2022-07-23 op test_done $testroot $ret
1812 38d61ead 2022-07-23 op return 1
1813 38d61ead 2022-07-23 op fi
1814 38d61ead 2022-07-23 op
1815 2fed5287 2024-04-09 op seq 10 | sed -e s/5/five/g -e s/6/six/g > $testroot/wt/numbers
1816 38d61ead 2022-07-23 op (cd $testroot/wt && got commit -m 'edit numbers again') >/dev/null
1817 38d61ead 2022-07-23 op ret=$?
1818 38d61ead 2022-07-23 op if [ $ret -ne 0 ]; then
1819 38d61ead 2022-07-23 op test_done $testroot $ret
1820 38d61ead 2022-07-23 op return 1
1821 38d61ead 2022-07-23 op fi
1822 38d61ead 2022-07-23 op
1823 38d61ead 2022-07-23 op (cd $testroot/wt && got patch -R patch) >/dev/null 2>&1
1824 38d61ead 2022-07-23 op ret=$?
1825 38d61ead 2022-07-23 op if [ $ret -eq 0 ]; then
1826 38d61ead 2022-07-23 op echo "unexpectedly reverted the patch" >&2
1827 38d61ead 2022-07-23 op test_done $testroot 1
1828 38d61ead 2022-07-23 op return 1
1829 38d61ead 2022-07-23 op fi
1830 38d61ead 2022-07-23 op
1831 38d61ead 2022-07-23 op cat <<-EOF > $testroot/wt/numbers.expected
1832 38d61ead 2022-07-23 op 1
1833 38d61ead 2022-07-23 op 2
1834 38d61ead 2022-07-23 op 3
1835 38d61ead 2022-07-23 op 4
1836 38d61ead 2022-07-23 op <<<<<<< --- numbers
1837 38d61ead 2022-07-23 op 5
1838 38d61ead 2022-07-23 op 6
1839 38d61ead 2022-07-23 op ||||||| +++ numbers
1840 38d61ead 2022-07-23 op five
1841 38d61ead 2022-07-23 op =======
1842 38d61ead 2022-07-23 op five
1843 38d61ead 2022-07-23 op six
1844 38d61ead 2022-07-23 op >>>>>>> commit $commit_id
1845 38d61ead 2022-07-23 op 7
1846 38d61ead 2022-07-23 op 8
1847 38d61ead 2022-07-23 op 9
1848 38d61ead 2022-07-23 op 10
1849 38d61ead 2022-07-23 op EOF
1850 38d61ead 2022-07-23 op
1851 38d61ead 2022-07-23 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1852 38d61ead 2022-07-23 op ret=$?
1853 38d61ead 2022-07-23 op if [ $ret -ne 0 ]; then
1854 38d61ead 2022-07-23 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1855 611e5fc2 2022-09-21 mark fi
1856 611e5fc2 2022-09-21 mark test_done $testroot $ret
1857 611e5fc2 2022-09-21 mark }
1858 611e5fc2 2022-09-21 mark
1859 611e5fc2 2022-09-21 mark test_patch_newfile_xbit_got_diff() {
1860 611e5fc2 2022-09-21 mark local testroot=`test_init patch_newfile_xbit`
1861 611e5fc2 2022-09-21 mark
1862 611e5fc2 2022-09-21 mark got checkout $testroot/repo $testroot/wt > /dev/null
1863 611e5fc2 2022-09-21 mark ret=$?
1864 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1865 611e5fc2 2022-09-21 mark test_done $testroot $ret
1866 611e5fc2 2022-09-21 mark return 1
1867 611e5fc2 2022-09-21 mark fi
1868 611e5fc2 2022-09-21 mark
1869 611e5fc2 2022-09-21 mark cat <<EOF > $testroot/wt/patch
1870 611e5fc2 2022-09-21 mark blob - /dev/null
1871 611e5fc2 2022-09-21 mark blob + abcdef0123456789abcdef012345678901234567 (mode 755)
1872 611e5fc2 2022-09-21 mark --- /dev/null
1873 611e5fc2 2022-09-21 mark +++ xfile
1874 611e5fc2 2022-09-21 mark @@ -0,0 +1,1 @@
1875 611e5fc2 2022-09-21 mark +xfile
1876 611e5fc2 2022-09-21 mark EOF
1877 611e5fc2 2022-09-21 mark
1878 611e5fc2 2022-09-21 mark (cd $testroot/wt && got patch patch) > /dev/null
1879 611e5fc2 2022-09-21 mark ret=$?
1880 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1881 611e5fc2 2022-09-21 mark test_done $testroot $ret
1882 611e5fc2 2022-09-21 mark return 1
1883 38d61ead 2022-07-23 op fi
1884 611e5fc2 2022-09-21 mark
1885 611e5fc2 2022-09-21 mark if [ ! -x $testroot/wt/xfile ]; then
1886 611e5fc2 2022-09-21 mark echo "failed to set xbit on newfile" >&2
1887 611e5fc2 2022-09-21 mark test_done $testroot 1
1888 611e5fc2 2022-09-21 mark return 1
1889 611e5fc2 2022-09-21 mark fi
1890 611e5fc2 2022-09-21 mark
1891 611e5fc2 2022-09-21 mark echo xfile > $testroot/wt/xfile.expected
1892 611e5fc2 2022-09-21 mark cmp -s $testroot/wt/xfile $testroot/wt/xfile.expected
1893 611e5fc2 2022-09-21 mark ret=$?
1894 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1895 611e5fc2 2022-09-21 mark echo "fail"
1896 611e5fc2 2022-09-21 mark diff -u $testroot/wt/xfile $testroot/wt/xfile.expected
1897 611e5fc2 2022-09-21 mark fi
1898 611e5fc2 2022-09-21 mark
1899 38d61ead 2022-07-23 op test_done $testroot $ret
1900 38d61ead 2022-07-23 op }
1901 38d61ead 2022-07-23 op
1902 611e5fc2 2022-09-21 mark test_patch_newfile_xbit_git_diff() {
1903 611e5fc2 2022-09-21 mark local testroot=`test_init patch_newfile_xbit`
1904 611e5fc2 2022-09-21 mark
1905 611e5fc2 2022-09-21 mark got checkout $testroot/repo $testroot/wt > /dev/null
1906 611e5fc2 2022-09-21 mark ret=$?
1907 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1908 611e5fc2 2022-09-21 mark test_done $testroot $ret
1909 611e5fc2 2022-09-21 mark return 1
1910 611e5fc2 2022-09-21 mark fi
1911 611e5fc2 2022-09-21 mark
1912 611e5fc2 2022-09-21 mark cat <<EOF > $testroot/wt/patch
1913 611e5fc2 2022-09-21 mark diff --git a/xfile b/xfile
1914 611e5fc2 2022-09-21 mark new file mode 100755
1915 611e5fc2 2022-09-21 mark index 00000000..abcdef01
1916 611e5fc2 2022-09-21 mark --- /dev/null
1917 611e5fc2 2022-09-21 mark +++ b/xfile
1918 611e5fc2 2022-09-21 mark @@ -0,0 +1,1 @@
1919 611e5fc2 2022-09-21 mark +xfile
1920 611e5fc2 2022-09-21 mark EOF
1921 611e5fc2 2022-09-21 mark
1922 611e5fc2 2022-09-21 mark (cd $testroot/wt && got patch patch) > /dev/null
1923 611e5fc2 2022-09-21 mark ret=$?
1924 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1925 611e5fc2 2022-09-21 mark test_done $testroot $ret
1926 611e5fc2 2022-09-21 mark return 1
1927 611e5fc2 2022-09-21 mark fi
1928 611e5fc2 2022-09-21 mark
1929 611e5fc2 2022-09-21 mark if [ ! -x $testroot/wt/xfile ]; then
1930 611e5fc2 2022-09-21 mark echo "failed to set xbit on newfile" >&2
1931 611e5fc2 2022-09-21 mark test_done $testroot 1
1932 611e5fc2 2022-09-21 mark return 1
1933 611e5fc2 2022-09-21 mark fi
1934 611e5fc2 2022-09-21 mark
1935 611e5fc2 2022-09-21 mark echo xfile > $testroot/wt/xfile.expected
1936 611e5fc2 2022-09-21 mark cmp -s $testroot/wt/xfile $testroot/wt/xfile.expected
1937 611e5fc2 2022-09-21 mark ret=$?
1938 611e5fc2 2022-09-21 mark if [ $ret -ne 0 ]; then
1939 611e5fc2 2022-09-21 mark echo "fail"
1940 611e5fc2 2022-09-21 mark diff -u $testroot/wt/xfile $testroot/wt/xfile.expected
1941 611e5fc2 2022-09-21 mark fi
1942 611e5fc2 2022-09-21 mark
1943 611e5fc2 2022-09-21 mark test_done $testroot $ret
1944 b2b3fce1 2022-10-29 op }
1945 b2b3fce1 2022-10-29 op
1946 b2b3fce1 2022-10-29 op test_patch_umask() {
1947 b2b3fce1 2022-10-29 op local testroot=`test_init patch_umask`
1948 b2b3fce1 2022-10-29 op
1949 b2b3fce1 2022-10-29 op got checkout "$testroot/repo" "$testroot/wt" >/dev/null
1950 b2b3fce1 2022-10-29 op
1951 b2b3fce1 2022-10-29 op cat <<EOF >$testroot/wt/patch
1952 b2b3fce1 2022-10-29 op --- alpha
1953 b2b3fce1 2022-10-29 op +++ alpha
1954 b2b3fce1 2022-10-29 op @@ -1 +1 @@
1955 b2b3fce1 2022-10-29 op -alpha
1956 b2b3fce1 2022-10-29 op +modified alpha
1957 b2b3fce1 2022-10-29 op EOF
1958 b2b3fce1 2022-10-29 op
1959 b2b3fce1 2022-10-29 op # using a subshell to avoid clobbering global umask
1960 b2b3fce1 2022-10-29 op (umask 077 && cd "$testroot/wt" && got patch <patch) >/dev/null
1961 b2b3fce1 2022-10-29 op ret=$?
1962 b2b3fce1 2022-10-29 op if [ $ret -ne 0 ]; then
1963 b2b3fce1 2022-10-29 op test_done "$testroot" $ret
1964 b2b3fce1 2022-10-29 op return 1
1965 b2b3fce1 2022-10-29 op fi
1966 b2b3fce1 2022-10-29 op
1967 b2b3fce1 2022-10-29 op if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
1968 b2b3fce1 2022-10-29 op echo "alpha is not 0600 after patch" >&2
1969 b2b3fce1 2022-10-29 op ls -l "$testroot/wt/alpha" >&2
1970 b2b3fce1 2022-10-29 op test_done "$testroot" 1
1971 b2b3fce1 2022-10-29 op return 1
1972 b2b3fce1 2022-10-29 op fi
1973 b2b3fce1 2022-10-29 op
1974 b2b3fce1 2022-10-29 op test_done "$testroot" 0
1975 611e5fc2 2022-09-21 mark }
1976 684a9a6c 2022-12-31 op
1977 684a9a6c 2022-12-31 op test_patch_remove_binary_file() {
1978 684a9a6c 2022-12-31 op local testroot=`test_init patch_remove_binary_file`
1979 684a9a6c 2022-12-31 op
1980 684a9a6c 2022-12-31 op if ! got checkout $testroot/repo $testroot/wt >/dev/null; then
1981 684a9a6c 2022-12-31 op test_done $testroot $ret
1982 684a9a6c 2022-12-31 op return 1
1983 684a9a6c 2022-12-31 op fi
1984 684a9a6c 2022-12-31 op
1985 684a9a6c 2022-12-31 op dd if=/dev/zero of=$testroot/wt/x bs=1 count=16 2>/dev/null >&2
1986 684a9a6c 2022-12-31 op (cd $testroot/wt && got add x && got commit -m +x) >/dev/null
1987 684a9a6c 2022-12-31 op
1988 684a9a6c 2022-12-31 op (cd $testroot/wt && \
1989 684a9a6c 2022-12-31 op got branch demo && \
1990 684a9a6c 2022-12-31 op got rm x && \
1991 684a9a6c 2022-12-31 op got ci -m -x &&
1992 684a9a6c 2022-12-31 op got up -b master) >/dev/null
1993 684a9a6c 2022-12-31 op
1994 684a9a6c 2022-12-31 op echo 'D x' > $testroot/stdout.expected
1995 611e5fc2 2022-09-21 mark
1996 684a9a6c 2022-12-31 op (cd $testroot/wt && got log -c demo -l 1 -p >patch)
1997 684a9a6c 2022-12-31 op
1998 684a9a6c 2022-12-31 op (cd $testroot/wt && got patch <patch) > $testroot/stdout
1999 684a9a6c 2022-12-31 op if [ $? -ne 0 ]; then
2000 684a9a6c 2022-12-31 op echo 'patch failed' >&2
2001 684a9a6c 2022-12-31 op test_done $testroot 1
2002 684a9a6c 2022-12-31 op return 1
2003 684a9a6c 2022-12-31 op fi
2004 684a9a6c 2022-12-31 op
2005 684a9a6c 2022-12-31 op if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2006 684a9a6c 2022-12-31 op diff -u $testroot/stdout.expected $testroot/stdout
2007 684a9a6c 2022-12-31 op test_done $testroot 1
2008 684a9a6c 2022-12-31 op return 1
2009 684a9a6c 2022-12-31 op fi
2010 684a9a6c 2022-12-31 op
2011 684a9a6c 2022-12-31 op # try again using a git produced diff
2012 684a9a6c 2022-12-31 op (cd $testroot/wt && got revert x) >/dev/null
2013 684a9a6c 2022-12-31 op
2014 f73bf5bd 2023-10-01 naddy git -C $testroot/repo show demo >$testroot/wt/patch
2015 684a9a6c 2022-12-31 op
2016 684a9a6c 2022-12-31 op (cd $testroot/wt && got patch <patch) > $testroot/stdout
2017 684a9a6c 2022-12-31 op if [ $? -ne 0 ]; then
2018 684a9a6c 2022-12-31 op echo 'patch failed' >&2
2019 684a9a6c 2022-12-31 op test_done $testroot 1
2020 684a9a6c 2022-12-31 op return 1
2021 684a9a6c 2022-12-31 op fi
2022 684a9a6c 2022-12-31 op
2023 684a9a6c 2022-12-31 op if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2024 684a9a6c 2022-12-31 op diff -u $testroot/stdout.expected $testroot/stdout
2025 684a9a6c 2022-12-31 op test_done $testroot 1
2026 684a9a6c 2022-12-31 op return 1
2027 684a9a6c 2022-12-31 op fi
2028 684a9a6c 2022-12-31 op
2029 684a9a6c 2022-12-31 op # try again using a diff(1) style patch
2030 684a9a6c 2022-12-31 op (cd $testroot/wt && got revert x) >/dev/null
2031 684a9a6c 2022-12-31 op
2032 684a9a6c 2022-12-31 op echo "Binary files x and /dev/null differ" >$testroot/wt/patch
2033 684a9a6c 2022-12-31 op (cd $testroot/wt && got patch <patch) >$testroot/stdout
2034 684a9a6c 2022-12-31 op if [ $? -ne 0 ]; then
2035 684a9a6c 2022-12-31 op echo 'patch failed' >&2
2036 684a9a6c 2022-12-31 op test_done $testroot 1
2037 684a9a6c 2022-12-31 op return 1
2038 684a9a6c 2022-12-31 op fi
2039 684a9a6c 2022-12-31 op
2040 684a9a6c 2022-12-31 op if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2041 684a9a6c 2022-12-31 op diff -u $testroot/stdout.expected $testroot/stdout
2042 684a9a6c 2022-12-31 op test_done $testroot 1
2043 684a9a6c 2022-12-31 op return 1
2044 684a9a6c 2022-12-31 op fi
2045 684a9a6c 2022-12-31 op
2046 684a9a6c 2022-12-31 op test_done $testroot 0
2047 684a9a6c 2022-12-31 op }
2048 c8d1a97c 2023-07-17 mark
2049 c8d1a97c 2023-07-17 mark test_patch_commit_keywords() {
2050 c8d1a97c 2023-07-17 mark local testroot=`test_init patch_commit_keywords`
2051 c8d1a97c 2023-07-17 mark
2052 c8d1a97c 2023-07-17 mark got checkout $testroot/repo $testroot/wt >/dev/null
2053 c8d1a97c 2023-07-17 mark ret=$?
2054 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2055 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2056 c8d1a97c 2023-07-17 mark return 1
2057 c8d1a97c 2023-07-17 mark fi
2058 c8d1a97c 2023-07-17 mark
2059 2fed5287 2024-04-09 op seq 10 > $testroot/wt/numbers
2060 c8d1a97c 2023-07-17 mark (cd $testroot/wt && got add numbers && got commit -m +numbers) \
2061 c8d1a97c 2023-07-17 mark >/dev/null
2062 c8d1a97c 2023-07-17 mark ret=$?
2063 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2064 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2065 c8d1a97c 2023-07-17 mark return 1
2066 c8d1a97c 2023-07-17 mark fi
2067 c8d1a97c 2023-07-17 mark
2068 2fed5287 2024-04-09 op seq 10 | sed s/4/four/ > $testroot/wt/numbers
2069 c8d1a97c 2023-07-17 mark
2070 c8d1a97c 2023-07-17 mark # get rid of the metadata
2071 c8d1a97c 2023-07-17 mark (cd $testroot/wt && got diff | sed -n '/^---/,$p' > patch) \
2072 c8d1a97c 2023-07-17 mark >/dev/null
2073 684a9a6c 2022-12-31 op
2074 2fed5287 2024-04-09 op seq 10 | sed s/6/six/ > $testroot/wt/numbers
2075 c8d1a97c 2023-07-17 mark (cd $testroot/wt && got commit -m 'edit numbers') >/dev/null
2076 c8d1a97c 2023-07-17 mark ret=$?
2077 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2078 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2079 c8d1a97c 2023-07-17 mark return 1
2080 c8d1a97c 2023-07-17 mark fi
2081 c8d1a97c 2023-07-17 mark
2082 c8d1a97c 2023-07-17 mark (cd $testroot/wt && got patch -c :head:- patch) >$testroot/stdout
2083 c8d1a97c 2023-07-17 mark ret=$?
2084 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2085 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2086 c8d1a97c 2023-07-17 mark return 1
2087 c8d1a97c 2023-07-17 mark fi
2088 c8d1a97c 2023-07-17 mark
2089 c8d1a97c 2023-07-17 mark echo 'G numbers' > $testroot/stdout.expected
2090 c8d1a97c 2023-07-17 mark cmp -s $testroot/stdout $testroot/stdout.expected
2091 c8d1a97c 2023-07-17 mark ret=$?
2092 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2093 c8d1a97c 2023-07-17 mark diff -u $testroot/stdout $testroot/stdout.expected
2094 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2095 c8d1a97c 2023-07-17 mark return 1
2096 c8d1a97c 2023-07-17 mark fi
2097 c8d1a97c 2023-07-17 mark
2098 2fed5287 2024-04-09 op seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
2099 c8d1a97c 2023-07-17 mark cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
2100 c8d1a97c 2023-07-17 mark ret=$?
2101 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2102 c8d1a97c 2023-07-17 mark diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
2103 c8d1a97c 2023-07-17 mark fi
2104 c8d1a97c 2023-07-17 mark
2105 c8d1a97c 2023-07-17 mark (cd "$testroot/wt" && got rv numbers > /dev/null)
2106 c8d1a97c 2023-07-17 mark
2107 c8d1a97c 2023-07-17 mark (cd $testroot/wt && got patch -c :base:- patch) >$testroot/stdout
2108 c8d1a97c 2023-07-17 mark ret=$?
2109 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2110 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2111 c8d1a97c 2023-07-17 mark return 1
2112 c8d1a97c 2023-07-17 mark fi
2113 c8d1a97c 2023-07-17 mark
2114 c8d1a97c 2023-07-17 mark echo 'G numbers' > $testroot/stdout.expected
2115 c8d1a97c 2023-07-17 mark cmp -s $testroot/stdout $testroot/stdout.expected
2116 c8d1a97c 2023-07-17 mark ret=$?
2117 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2118 c8d1a97c 2023-07-17 mark diff -u $testroot/stdout $testroot/stdout.expected
2119 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2120 c8d1a97c 2023-07-17 mark return 1
2121 c8d1a97c 2023-07-17 mark fi
2122 c8d1a97c 2023-07-17 mark
2123 2fed5287 2024-04-09 op seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
2124 c8d1a97c 2023-07-17 mark cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
2125 c8d1a97c 2023-07-17 mark ret=$?
2126 c8d1a97c 2023-07-17 mark if [ $ret -ne 0 ]; then
2127 c8d1a97c 2023-07-17 mark diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
2128 c8d1a97c 2023-07-17 mark fi
2129 c8d1a97c 2023-07-17 mark
2130 c8d1a97c 2023-07-17 mark test_done $testroot $ret
2131 c8d1a97c 2023-07-17 mark }
2132 c8d1a97c 2023-07-17 mark
2133 e9ce266e 2022-03-07 op test_parseargs "$@"
2134 57b1c3f2 2022-08-01 op run_test test_patch_basic
2135 e9ce266e 2022-03-07 op run_test test_patch_dont_apply
2136 e9ce266e 2022-03-07 op run_test test_patch_malformed
2137 e9ce266e 2022-03-07 op run_test test_patch_no_patch
2138 e9ce266e 2022-03-07 op run_test test_patch_equals_for_context
2139 6e96b326 2022-03-12 op run_test test_patch_rename
2140 dbda770b 2022-03-13 op run_test test_patch_illegal_status
2141 899fcfdf 2022-03-13 op run_test test_patch_nop
2142 2be5e1a2 2022-03-16 op run_test test_patch_preserve_perm
2143 95d68340 2022-03-16 op run_test test_patch_create_dirs
2144 60aa1fa0 2022-03-17 op run_test test_patch_with_offset
2145 04a87797 2024-04-23 op run_test test_patch_empty_file
2146 7a30b5cb 2022-03-20 op run_test test_patch_prefer_new_path
2147 b3c57ab2 2022-03-22 op run_test test_patch_no_newline
2148 9d6cabd5 2022-04-07 op run_test test_patch_strip
2149 a92a2042 2022-07-02 op run_test test_patch_whitespace
2150 ed3bff83 2022-04-23 op run_test test_patch_relative_paths
2151 15e1bda6 2022-04-23 op run_test test_patch_with_path_prefix
2152 15e1bda6 2022-04-23 op run_test test_patch_relpath_with_path_prefix
2153 bad961bf 2022-04-23 op run_test test_patch_reverse
2154 55e9459f 2022-06-19 op run_test test_patch_merge_simple
2155 db0dfdd7 2022-06-27 op run_test test_patch_merge_gitdiff
2156 5f56d41e 2022-07-28 op run_test test_patch_merge_base_provided
2157 55e9459f 2022-06-19 op run_test test_patch_merge_conflict
2158 55e9459f 2022-06-19 op run_test test_patch_merge_unknown_blob
2159 38d61ead 2022-07-23 op run_test test_patch_merge_reverse
2160 611e5fc2 2022-09-21 mark run_test test_patch_newfile_xbit_got_diff
2161 611e5fc2 2022-09-21 mark run_test test_patch_newfile_xbit_git_diff
2162 b2b3fce1 2022-10-29 op run_test test_patch_umask
2163 684a9a6c 2022-12-31 op run_test test_patch_remove_binary_file
2164 c8d1a97c 2023-07-17 mark run_test test_patch_commit_keywords