3 e9ce266e 2022-03-07 op # Copyright (c) 2022 Omar Polo <op@openbsd.org>
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.
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.
19 ed2ff8b9 2022-07-02 op test_patch_add_file() {
20 ed2ff8b9 2022-07-02 op local testroot=`test_init patch_add_file`
22 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
24 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
25 e9ce266e 2022-03-07 op test_done $testroot $ret
29 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
32 ed2ff8b9 2022-07-02 op @@ -0,0 +5,5 @@
40 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
42 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
43 e9ce266e 2022-03-07 op test_done $testroot $ret
47 e9ce266e 2022-03-07 op echo "A eta" > $testroot/stdout.expected
48 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
50 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
51 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
52 e9ce266e 2022-03-07 op test_done $testroot $ret
56 ed2ff8b9 2022-07-02 op jot 5 > $testroot/wt/eta.expected
57 e9ce266e 2022-03-07 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
59 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
60 e9ce266e 2022-03-07 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
62 e9ce266e 2022-03-07 op test_done $testroot $ret
65 f5b0315f 2022-07-02 op test_patch_rm_file() {
66 f5b0315f 2022-07-02 op local testroot=`test_init patch_rm_file`
68 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
70 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
71 e9ce266e 2022-03-07 op test_done $testroot $ret
75 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
82 e9ce266e 2022-03-07 op echo "D alpha" > $testroot/stdout.expected
84 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
86 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
87 e9ce266e 2022-03-07 op test_done $testroot $ret
91 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
93 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
94 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
95 e9ce266e 2022-03-07 op test_done $testroot $ret
99 e9ce266e 2022-03-07 op if [ -f $testroot/wt/alpha ]; then
101 e9ce266e 2022-03-07 op echo "alpha still exists!"
103 e9ce266e 2022-03-07 op test_done $testroot $ret
106 e9ce266e 2022-03-07 op test_patch_simple_edit_file() {
107 e9ce266e 2022-03-07 op local testroot=`test_init patch_simple_edit_file`
109 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
111 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
112 e9ce266e 2022-03-07 op test_done $testroot $ret
116 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
121 e9ce266e 2022-03-07 op +alpha is my favourite character
124 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
126 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
128 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
129 e9ce266e 2022-03-07 op test_done $testroot $ret
133 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
135 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
136 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
137 e9ce266e 2022-03-07 op test_done $testroot $ret
141 e9ce266e 2022-03-07 op echo 'alpha is my favourite character' > $testroot/wt/alpha.expected
142 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
144 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
145 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
147 e9ce266e 2022-03-07 op test_done $testroot $ret
150 e9ce266e 2022-03-07 op test_patch_prepend_line() {
151 e9ce266e 2022-03-07 op local testroot=`test_init patch_prepend_line`
153 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
155 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
156 e9ce266e 2022-03-07 op test_done $testroot $ret
160 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
163 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
168 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
170 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
172 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
173 e9ce266e 2022-03-07 op test_done $testroot $ret
177 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
179 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
180 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
181 e9ce266e 2022-03-07 op test_done $testroot $ret
185 e9ce266e 2022-03-07 op echo hatsuseno > $testroot/wt/alpha.expected
186 e9ce266e 2022-03-07 op echo alpha >> $testroot/wt/alpha.expected
187 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
189 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
190 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
192 e9ce266e 2022-03-07 op test_done $testroot $ret
195 e9ce266e 2022-03-07 op test_patch_replace_line() {
196 e9ce266e 2022-03-07 op local testroot=`test_init patch_replace_line`
198 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
200 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
201 e9ce266e 2022-03-07 op test_done $testroot $ret
205 e9ce266e 2022-03-07 op jot 10 > $testroot/wt/numbers
206 e9ce266e 2022-03-07 op (cd $testroot/wt/ && got add numbers && got ci -m 'add numbers') \
209 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
210 e9ce266e 2022-03-07 op test_done $testroot $ret
214 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
217 e9ce266e 2022-03-07 op @@ -3,7 +3,7 @@
228 e9ce266e 2022-03-07 op echo "M numbers" > $testroot/stdout.expected
230 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
232 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
233 e9ce266e 2022-03-07 op test_done $testroot $ret
237 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
239 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
240 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
241 e9ce266e 2022-03-07 op test_done $testroot $ret
245 e9ce266e 2022-03-07 op jot 10 | sed 's/6/foo/' > $testroot/wt/numbers.expected
246 e9ce266e 2022-03-07 op cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
248 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
249 e9ce266e 2022-03-07 op diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
251 e9ce266e 2022-03-07 op test_done $testroot $ret
254 e9ce266e 2022-03-07 op test_patch_multiple_hunks() {
255 fd79e2e0 2022-03-08 op local testroot=`test_init patch_replace_multiple_hunks`
257 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
259 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
260 e9ce266e 2022-03-07 op test_done $testroot $ret
264 e9ce266e 2022-03-07 op jot 100 > $testroot/wt/numbers
265 e9ce266e 2022-03-07 op (cd $testroot/wt/ && got add numbers && got ci -m 'add numbers') \
268 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
269 e9ce266e 2022-03-07 op test_done $testroot $ret
273 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
276 e9ce266e 2022-03-07 op @@ -3,7 +3,7 @@
285 e9ce266e 2022-03-07 op @@ -57,7 +57,7 @@
294 e9ce266e 2022-03-07 op @@ -98,3 +98,6 @@
303 e9ce266e 2022-03-07 op echo "M numbers" > $testroot/stdout.expected
305 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
307 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
308 e9ce266e 2022-03-07 op test_done $testroot $ret
312 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
314 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
315 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
316 e9ce266e 2022-03-07 op test_done $testroot $ret
320 e9ce266e 2022-03-07 op jot 100 | sed -e 's/^6$/foo/' -e 's/^60$/foo foo/' \
321 e9ce266e 2022-03-07 op > $testroot/wt/numbers.expected
322 e9ce266e 2022-03-07 op echo "101" >> $testroot/wt/numbers.expected
323 e9ce266e 2022-03-07 op echo "102" >> $testroot/wt/numbers.expected
324 e9ce266e 2022-03-07 op echo "..." >> $testroot/wt/numbers.expected
326 e9ce266e 2022-03-07 op cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
328 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
329 e9ce266e 2022-03-07 op diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
331 e9ce266e 2022-03-07 op test_done $testroot $ret
334 e9ce266e 2022-03-07 op test_patch_multiple_files() {
335 e9ce266e 2022-03-07 op local testroot=`test_init patch_multiple_files`
337 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
339 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
340 e9ce266e 2022-03-07 op test_done $testroot $ret
344 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
345 e9ce266e 2022-03-07 op --- alpha Mon Mar 7 19:02:07 2022
346 e9ce266e 2022-03-07 op +++ alpha Mon Mar 7 19:01:53 2022
347 e9ce266e 2022-03-07 op @@ -1 +1,3 @@
351 e9ce266e 2022-03-07 op --- beta Mon Mar 7 19:02:11 2022
352 e9ce266e 2022-03-07 op +++ beta Mon Mar 7 19:01:46 2022
353 e9ce266e 2022-03-07 op @@ -1 +1,3 @@
357 e9ce266e 2022-03-07 op --- gamma/delta Mon Mar 7 19:02:17 2022
358 e9ce266e 2022-03-07 op +++ gamma/delta Mon Mar 7 19:01:37 2022
364 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
365 e9ce266e 2022-03-07 op echo "M beta" >> $testroot/stdout.expected
366 e9ce266e 2022-03-07 op echo "M gamma/delta" >> $testroot/stdout.expected
368 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
370 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
371 fd79e2e0 2022-03-08 op test_done $testroot $ret
375 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
377 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
378 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
379 e9ce266e 2022-03-07 op test_done $testroot $ret
383 e9ce266e 2022-03-07 op printf 'new\nalpha\navailable\n' > $testroot/wt/alpha.expected
384 e9ce266e 2022-03-07 op printf 'beta\nwas\nimproved\n' > $testroot/wt/beta.expected
385 e9ce266e 2022-03-07 op printf 'delta new\n' > $testroot/wt/gamma/delta.expected
387 e9ce266e 2022-03-07 op for f in alpha beta gamma/delta; do
388 e9ce266e 2022-03-07 op cmp -s $testroot/wt/$f.expected $testroot/wt/$f
390 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
391 e9ce266e 2022-03-07 op diff -u $testroot/wt/$f.expected $testroot/wt/$f
392 e9ce266e 2022-03-07 op test_done $testroot $ret
397 e9ce266e 2022-03-07 op test_done $testroot 0
400 e9ce266e 2022-03-07 op test_patch_dont_apply() {
401 e9ce266e 2022-03-07 op local testroot=`test_init patch_dont_apply`
403 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
405 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
406 e9ce266e 2022-03-07 op test_done $testroot $ret
410 5b67f96e 2022-03-13 op jot 100 > $testroot/wt/numbers
411 5b67f96e 2022-03-13 op (cd $testroot/wt && got add numbers && got commit -m 'add numbers') \
414 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
415 5b67f96e 2022-03-13 op test_done $testroot $ret
419 5b67f96e 2022-03-13 op cat <<EOF > $testroot/wt/patch
422 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
424 60aa1fa0 2022-03-17 op alpha something
426 5b67f96e 2022-03-13 op +++ /dev/null
427 5b67f96e 2022-03-13 op @@ -1,9 +0,0 @@
439 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout 2> /dev/null
441 5b67f96e 2022-03-13 op if [ $ret -eq 0 ]; then # should fail
442 5b67f96e 2022-03-13 op test_done $testroot 1
446 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
448 60aa1fa0 2022-03-17 op @@ -1,1 +1,2 @@ hunk failed to apply
450 60aa1fa0 2022-03-17 op @@ -1,9 +0,0 @@ hunk failed to apply
453 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
455 5b67f96e 2022-03-13 op if [ $ret -ne 0 ]; then
456 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
458 e9ce266e 2022-03-07 op test_done $testroot $ret
461 e9ce266e 2022-03-07 op test_patch_malformed() {
462 e9ce266e 2022-03-07 op local testroot=`test_init patch_malformed`
464 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
466 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
467 e9ce266e 2022-03-07 op test_done $testroot $ret
471 e9ce266e 2022-03-07 op # missing "@@"
472 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
480 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
481 e9ce266e 2022-03-07 op echo "got: malformed patch" > $testroot/stderr.expected
483 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
484 e9ce266e 2022-03-07 op > $testroot/stdout \
485 e9ce266e 2022-03-07 op 2> $testroot/stderr
487 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
488 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
489 e9ce266e 2022-03-07 op test_done $testroot 1
493 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
495 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
496 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
497 e9ce266e 2022-03-07 op test_done $testroot $ret
501 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
503 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
504 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
505 e9ce266e 2022-03-07 op test_done $testroot $ret
509 e9ce266e 2022-03-07 op # wrong first character
510 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
513 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
518 be33dff7 2022-05-13 op (cd $testroot/wt && got patch patch) \
519 be33dff7 2022-05-13 op > $testroot/stdout \
520 be33dff7 2022-05-13 op 2> $testroot/stderr
522 be33dff7 2022-05-13 op if [ $ret -eq 0 ]; then
523 be33dff7 2022-05-13 op echo "got managed to apply an invalid patch"
524 be33dff7 2022-05-13 op test_done $testroot 1
528 be33dff7 2022-05-13 op cmp -s $testroot/stdout.expected $testroot/stdout
530 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
531 be33dff7 2022-05-13 op diff -u $testroot/stdout.expected $testroot/stdout
532 be33dff7 2022-05-13 op test_done $testroot $ret
536 be33dff7 2022-05-13 op cmp -s $testroot/stderr.expected $testroot/stderr
538 be33dff7 2022-05-13 op if [ $ret -ne 0 ]; then
539 be33dff7 2022-05-13 op diff -u $testroot/stderr.expected $testroot/stderr
540 be33dff7 2022-05-13 op test_done $testroot $ret
545 be33dff7 2022-05-13 op cat <<EOF > $testroot/wt/patch
546 be33dff7 2022-05-13 op diff --git a/alpha b/iota
549 be33dff7 2022-05-13 op @@ -0,0 +0,0 @@
552 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
553 e9ce266e 2022-03-07 op > $testroot/stdout \
554 e9ce266e 2022-03-07 op 2> $testroot/stderr
556 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then
557 e9ce266e 2022-03-07 op echo "got managed to apply an invalid patch"
558 e9ce266e 2022-03-07 op test_done $testroot 1
562 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
564 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
565 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
566 e9ce266e 2022-03-07 op test_done $testroot $ret
570 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
572 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
573 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
574 e9ce266e 2022-03-07 op test_done $testroot $ret
578 e9ce266e 2022-03-07 op test_done $testroot $ret
581 e9ce266e 2022-03-07 op test_patch_no_patch() {
582 e9ce266e 2022-03-07 op local testroot=`test_init patch_no_patch`
584 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
586 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
587 e9ce266e 2022-03-07 op test_done $testroot $ret
591 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
595 e9ce266e 2022-03-07 op some other nonsense
598 e9ce266e 2022-03-07 op there's no patch in here!
601 e9ce266e 2022-03-07 op echo -n > $testroot/stdout.expected
602 e9ce266e 2022-03-07 op echo "got: no patch found" > $testroot/stderr.expected
604 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) \
605 e9ce266e 2022-03-07 op > $testroot/stdout \
606 e9ce266e 2022-03-07 op 2> $testroot/stderr
608 bfbccd0a 2022-03-08 op if [ $ret -eq 0 ]; then # should fail
609 e9ce266e 2022-03-07 op test_done $testroot 1
613 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
615 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
616 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
617 e9ce266e 2022-03-07 op test_done $testroot $ret
621 e9ce266e 2022-03-07 op cmp -s $testroot/stderr.expected $testroot/stderr
623 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
624 e9ce266e 2022-03-07 op diff -u $testroot/stderr.expected $testroot/stderr
625 e9ce266e 2022-03-07 op test_done $testroot $ret
629 e9ce266e 2022-03-07 op test_done $testroot $ret
632 e9ce266e 2022-03-07 op test_patch_equals_for_context() {
633 f1d6cebb 2022-04-23 op local testroot=`test_init patch_equals_for_context`
635 e9ce266e 2022-03-07 op got checkout $testroot/repo $testroot/wt > /dev/null
637 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
638 e9ce266e 2022-03-07 op test_done $testroot $ret
642 e9ce266e 2022-03-07 op cat <<EOF > $testroot/wt/patch
645 e9ce266e 2022-03-07 op @@ -1 +1,2 @@
650 e9ce266e 2022-03-07 op echo "M alpha" > $testroot/stdout.expected
652 e9ce266e 2022-03-07 op (cd $testroot/wt && got patch patch) > $testroot/stdout
654 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
655 e9ce266e 2022-03-07 op test_done $testroot $ret
659 e9ce266e 2022-03-07 op cmp -s $testroot/stdout.expected $testroot/stdout
661 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
662 e9ce266e 2022-03-07 op diff -u $testroot/stdout.expected $testroot/stdout
663 e9ce266e 2022-03-07 op test_done $testroot $ret
667 e9ce266e 2022-03-07 op echo hatsuseno > $testroot/wt/alpha.expected
668 e9ce266e 2022-03-07 op echo alpha >> $testroot/wt/alpha.expected
669 e9ce266e 2022-03-07 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
671 bfbccd0a 2022-03-08 op if [ $ret -ne 0 ]; then
672 e9ce266e 2022-03-07 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
674 e9ce266e 2022-03-07 op test_done $testroot $ret
677 6e96b326 2022-03-12 op test_patch_rename() {
678 6e96b326 2022-03-12 op local testroot=`test_init patch_rename`
680 6e96b326 2022-03-12 op got checkout $testroot/repo $testroot/wt > /dev/null
682 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
683 6e96b326 2022-03-12 op test_done $testroot $ret
687 6e96b326 2022-03-12 op cat <<EOF > $testroot/wt/patch
688 4379a9aa 2022-05-02 op diff --git a/beta b/iota
689 4379a9aa 2022-05-02 op similarity index 100%
690 4379a9aa 2022-05-02 op rename from beta
691 4379a9aa 2022-05-02 op rename to iota
692 7a30b5cb 2022-03-20 op diff --git a/alpha b/eta
700 4379a9aa 2022-05-02 op echo 'D beta' > $testroot/stdout.expected
701 4379a9aa 2022-05-02 op echo 'A iota' >> $testroot/stdout.expected
702 4379a9aa 2022-05-02 op echo 'D alpha' >> $testroot/stdout.expected
703 4379a9aa 2022-05-02 op echo 'A eta' >> $testroot/stdout.expected
705 6e96b326 2022-03-12 op (cd $testroot/wt && got patch patch) > $testroot/stdout
707 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
708 6e96b326 2022-03-12 op test_done $testroot $ret
712 6e96b326 2022-03-12 op cmp -s $testroot/stdout.expected $testroot/stdout
714 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
715 6e96b326 2022-03-12 op diff -u $testroot/stdout.expected $testroot/stdout
716 6e96b326 2022-03-12 op test_done $testroot $ret
720 4379a9aa 2022-05-02 op if [ -f $testroot/wt/alpha -o -f $testroot/wt/beta ]; then
721 4379a9aa 2022-05-02 op echo "alpha or beta were not removed" >&2
722 6e96b326 2022-03-12 op test_done $testroot 1
725 4379a9aa 2022-05-02 op if [ ! -f $testroot/wt/iota -o ! -f $testroot/wt/eta ]; then
726 4379a9aa 2022-05-02 op echo "iota or eta were not created" >&2
727 6e96b326 2022-03-12 op test_done $testroot 1
731 4379a9aa 2022-05-02 op echo beta > $testroot/wt/iota.expected
732 4379a9aa 2022-05-02 op cmp -s $testroot/wt/iota.expected $testroot/wt/iota
734 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
735 4379a9aa 2022-05-02 op diff -u $testroot/wt/iota.expected $testroot/wt/iota
736 6e96b326 2022-03-12 op test_done $testroot $ret
740 4379a9aa 2022-05-02 op echo eta > $testroot/wt/eta.expected
741 4379a9aa 2022-05-02 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
743 6e96b326 2022-03-12 op if [ $ret -ne 0 ]; then
744 4379a9aa 2022-05-02 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
745 6e96b326 2022-03-12 op test_done $testroot $ret
749 6e96b326 2022-03-12 op test_done $testroot $ret
752 dbda770b 2022-03-13 op test_patch_illegal_status() {
753 dbda770b 2022-03-13 op local testroot=`test_init patch_illegal_status`
755 dbda770b 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
757 dbda770b 2022-03-13 op if [ $ret -ne 0 ]; then
758 dbda770b 2022-03-13 op test_done $testroot $ret
762 60aa1fa0 2022-03-17 op # try to patch an obstructed file, add a versioned one, edit a
763 60aa1fa0 2022-03-17 op # non existent file and an unversioned one, and remove a
764 60aa1fa0 2022-03-17 op # non existent file.
765 dbda770b 2022-03-13 op cat <<EOF > $testroot/wt/patch
768 60aa1fa0 2022-03-17 op @@ -1 +1,2 @@
771 60aa1fa0 2022-03-17 op --- /dev/null
773 60aa1fa0 2022-03-17 op @@ -0,0 +1 @@
786 60aa1fa0 2022-03-17 op +++ /dev/null
787 60aa1fa0 2022-03-17 op @@ -1 +0,0 @@
791 60aa1fa0 2022-03-17 op echo kappa > $testroot/wt/kappa
792 dbda770b 2022-03-13 op rm $testroot/wt/alpha
793 dbda770b 2022-03-13 op mkdir $testroot/wt/alpha
795 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout \
796 dbda770b 2022-03-13 op 2> $testroot/stderr
798 dbda770b 2022-03-13 op if [ $ret -eq 0 ]; then
799 dbda770b 2022-03-13 op echo "edited a missing file" >&2
800 a19f439c 2022-06-03 op test_done $testroot 1
804 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
812 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stderr.expected
813 60aa1fa0 2022-03-17 op got: alpha: file has unexpected status
814 60aa1fa0 2022-03-17 op got: beta: file has unexpected status
815 60aa1fa0 2022-03-17 op got: iota: No such file or directory
816 60aa1fa0 2022-03-17 op got: kappa: file has unexpected status
817 60aa1fa0 2022-03-17 op got: lambda: No such file or directory
818 60aa1fa0 2022-03-17 op got: patch failed to apply
821 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
823 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
824 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
825 dbda770b 2022-03-13 op test_done $testroot $ret
829 dbda770b 2022-03-13 op cmp -s $testroot/stderr.expected $testroot/stderr
831 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
832 dbda770b 2022-03-13 op diff -u $testroot/stderr.expected $testroot/stderr
833 78f5ac24 2022-03-19 op test_done $testroot $ret
837 78f5ac24 2022-03-19 op (cd $testroot/wt && got status) > $testroot/stdout
838 78f5ac24 2022-03-19 op cat <<EOF > $testroot/stdout.expected
844 78f5ac24 2022-03-19 op cmp -s $testroot/stdout.expected $testroot/stdout
846 78f5ac24 2022-03-19 op if [ $ret -ne 0 ]; then
847 78f5ac24 2022-03-19 op diff -u $testroot/stdout.expected $testroot/stdout
849 899fcfdf 2022-03-13 op test_done $testroot $ret
852 899fcfdf 2022-03-13 op test_patch_nop() {
853 899fcfdf 2022-03-13 op local testroot=`test_init patch_nop`
855 899fcfdf 2022-03-13 op got checkout $testroot/repo $testroot/wt > /dev/null
857 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
858 899fcfdf 2022-03-13 op test_done $testroot $ret
862 899fcfdf 2022-03-13 op cat <<EOF > $testroot/wt/patch
869 899fcfdf 2022-03-13 op +++ /dev/null
870 899fcfdf 2022-03-13 op @@ -1 +0,0 @@
872 7a30b5cb 2022-03-20 op diff --git a/gamma/delta b/gamma/delta.new
873 899fcfdf 2022-03-13 op --- gamma/delta
874 899fcfdf 2022-03-13 op +++ gamma/delta.new
877 899fcfdf 2022-03-13 op +delta updated and renamed!
880 899fcfdf 2022-03-13 op (cd $testroot/wt && got patch -n patch)
882 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
883 899fcfdf 2022-03-13 op test_done $testroot $ret
887 899fcfdf 2022-03-13 op # remove the patch to avoid the ? entry
888 899fcfdf 2022-03-13 op rm $testroot/wt/patch
890 899fcfdf 2022-03-13 op (cd $testroot/wt && got status) > $testroot/stdout
892 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
893 899fcfdf 2022-03-13 op test_done $testroot $ret
897 899fcfdf 2022-03-13 op echo -n > $testroot/stdout.expected
898 899fcfdf 2022-03-13 op cmp -s $testroot/stdout.expected $testroot/stdout
900 899fcfdf 2022-03-13 op if [ $ret -ne 0 ]; then
901 899fcfdf 2022-03-13 op diff -u $testroot/stdout.expected $testroot/stdout
903 dbda770b 2022-03-13 op test_done $testroot $ret
906 2be5e1a2 2022-03-16 op test_patch_preserve_perm() {
907 2be5e1a2 2022-03-16 op local testroot=`test_init patch_preserve_perm`
909 2be5e1a2 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
911 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
912 2be5e1a2 2022-03-16 op test_done $testroot $ret
916 2be5e1a2 2022-03-16 op chmod +x $testroot/wt/alpha
917 2be5e1a2 2022-03-16 op (cd $testroot/wt && got commit -m 'alpha executable') > /dev/null
919 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
920 2be5e1a2 2022-03-16 op test_done $testroot $ret
924 2be5e1a2 2022-03-16 op cat <<EOF > $testroot/wt/patch
927 2be5e1a2 2022-03-16 op @@ -1 +1,2 @@
932 2be5e1a2 2022-03-16 op (cd $testroot/wt && got patch patch) > /dev/null
934 2be5e1a2 2022-03-16 op if [ $ret -ne 0 ]; then
935 2be5e1a2 2022-03-16 op test_done $testroot $ret
939 2be5e1a2 2022-03-16 op if [ ! -x $testroot/wt/alpha ]; then
940 2be5e1a2 2022-03-16 op echo "alpha is no more executable!" >&2
941 2be5e1a2 2022-03-16 op test_done $testroot 1
944 95d68340 2022-03-16 op test_done $testroot 0
947 95d68340 2022-03-16 op test_patch_create_dirs() {
948 95d68340 2022-03-16 op local testroot=`test_init patch_create_dirs`
950 95d68340 2022-03-16 op got checkout $testroot/repo $testroot/wt > /dev/null
952 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
953 95d68340 2022-03-16 op test_done $testroot $ret
957 95d68340 2022-03-16 op cat <<EOF > $testroot/wt/patch
958 95d68340 2022-03-16 op --- /dev/null
959 95d68340 2022-03-16 op +++ iota/kappa/lambda
960 95d68340 2022-03-16 op @@ -0,0 +1 @@
964 95d68340 2022-03-16 op (cd $testroot/wt && got patch patch) > $testroot/stdout
966 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
967 95d68340 2022-03-16 op test_done $testroot $ret
971 95d68340 2022-03-16 op echo 'A iota/kappa/lambda' >> $testroot/stdout.expected
972 95d68340 2022-03-16 op cmp -s $testroot/stdout.expected $testroot/stdout
974 95d68340 2022-03-16 op if [ $ret -ne 0 ]; then
975 95d68340 2022-03-16 op diff -u $testroot/stdout.expected $testroot/stdout
976 95d68340 2022-03-16 op test_done $testroot $ret
980 95d68340 2022-03-16 op if [ ! -f $testroot/wt/iota/kappa/lambda ]; then
981 95d68340 2022-03-16 op echo "file not created!" >&2
982 95d68340 2022-03-16 op test_done $testroot $ret
985 2be5e1a2 2022-03-16 op test_done $testroot 0
988 60aa1fa0 2022-03-17 op test_patch_with_offset() {
989 60aa1fa0 2022-03-17 op local testroot=`test_init patch_with_offset`
991 60aa1fa0 2022-03-17 op got checkout $testroot/repo $testroot/wt > /dev/null
993 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
994 60aa1fa0 2022-03-17 op test_done $testroot $ret
998 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/wt/patch
1001 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@
1006 60aa1fa0 2022-03-17 op +midway tru it!
1010 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@
1015 60aa1fa0 2022-03-17 op +almost there!
1021 60aa1fa0 2022-03-17 op jot 100 > $testroot/wt/numbers
1022 60aa1fa0 2022-03-17 op ed $testroot/wt/numbers <<EOF > /dev/null 2> /dev/null
1029 60aa1fa0 2022-03-17 op (cd $testroot/wt && got add numbers && got commit -m '+numbers') \
1032 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1033 60aa1fa0 2022-03-17 op test_done $testroot $ret
1037 60aa1fa0 2022-03-17 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1039 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1040 60aa1fa0 2022-03-17 op test_done $testroot/wt $ret
1044 60aa1fa0 2022-03-17 op cat <<EOF > $testroot/stdout.expected
1046 60aa1fa0 2022-03-17 op @@ -47,7 +47,7 @@ applied with offset -10
1047 60aa1fa0 2022-03-17 op @@ -87,7 +87,7 @@ applied with offset 10
1050 7a30b5cb 2022-03-20 op cmp -s $testroot/stdout.expected $testroot/stdout
1052 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1053 7a30b5cb 2022-03-20 op diff -u $testroot/stdout.expected $testroot/stdout
1055 7a30b5cb 2022-03-20 op test_done $testroot $ret
1058 7a30b5cb 2022-03-20 op test_patch_prefer_new_path() {
1059 7a30b5cb 2022-03-20 op local testroot=`test_init patch_orig`
1061 7a30b5cb 2022-03-20 op got checkout $testroot/repo $testroot/wt > /dev/null
1063 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1064 7a30b5cb 2022-03-20 op test_done $testroot $ret
1068 7a30b5cb 2022-03-20 op cat <<EOF > $testroot/wt/patch
1069 7a30b5cb 2022-03-20 op --- alpha.orig
1071 7a30b5cb 2022-03-20 op @@ -1 +1,2 @@
1076 7a30b5cb 2022-03-20 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1078 7a30b5cb 2022-03-20 op if [ $ret -ne 0 ]; then
1079 7a30b5cb 2022-03-20 op test_done $testroot $ret
1083 3313bcd8 2022-04-19 op echo 'M alpha' > $testroot/stdout.expected
1084 60aa1fa0 2022-03-17 op cmp -s $testroot/stdout.expected $testroot/stdout
1086 60aa1fa0 2022-03-17 op if [ $ret -ne 0 ]; then
1087 60aa1fa0 2022-03-17 op diff -u $testroot/stdout.expected $testroot/stdout
1089 60aa1fa0 2022-03-17 op test_done $testroot $ret
1092 b3c57ab2 2022-03-22 op test_patch_no_newline() {
1093 b3c57ab2 2022-03-22 op local testroot=`test_init patch_no_newline`
1095 b3c57ab2 2022-03-22 op got checkout $testroot/repo $testroot/wt > /dev/null
1097 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1098 b3c57ab2 2022-03-22 op test_done $testroot $ret
1102 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1103 b3c57ab2 2022-03-22 op --- /dev/null
1105 b3c57ab2 2022-03-22 op @@ -0,0 +1 @@
1107 b3c57ab2 2022-03-22 op \ No newline at end of file
1110 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1112 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1113 b3c57ab2 2022-03-22 op test_done $testroot $ret
1117 b3c57ab2 2022-03-22 op echo "A eta" > $testroot/stdout.expected
1118 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1120 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1121 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1122 b3c57ab2 2022-03-22 op test_done $testroot $ret
1126 b3c57ab2 2022-03-22 op echo -n eta > $testroot/wt/eta.expected
1127 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1129 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1130 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1131 b3c57ab2 2022-03-22 op test_done $testroot $ret
1135 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'add eta') > /dev/null
1137 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1138 b3c57ab2 2022-03-22 op test_done $testroot $ret
1142 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1147 b3c57ab2 2022-03-22 op \ No newline at end of file
1149 b3c57ab2 2022-03-22 op \ No newline at end of file
1152 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1154 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1155 b3c57ab2 2022-03-22 op test_done $testroot $ret
1159 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1160 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1162 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1163 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1164 b3c57ab2 2022-03-22 op test_done $testroot $ret
1168 b3c57ab2 2022-03-22 op echo -n ETA > $testroot/wt/eta.expected
1169 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1171 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1172 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1173 b3c57ab2 2022-03-22 op test_done $testroot $ret
1177 b3c57ab2 2022-03-22 op (cd $testroot/wt && got commit -m 'edit eta') > /dev/null
1179 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1180 b3c57ab2 2022-03-22 op test_done $testroot $ret
1184 b3c57ab2 2022-03-22 op cat <<EOF > $testroot/wt/patch
1189 b3c57ab2 2022-03-22 op \ No newline at end of file
1193 b3c57ab2 2022-03-22 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1195 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1196 b3c57ab2 2022-03-22 op test_done $testroot $ret
1200 b3c57ab2 2022-03-22 op echo "M eta" > $testroot/stdout.expected
1201 b3c57ab2 2022-03-22 op cmp -s $testroot/stdout.expected $testroot/stdout
1203 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1204 b3c57ab2 2022-03-22 op diff -u $testroot/stdout.expected $testroot/stdout
1205 b3c57ab2 2022-03-22 op test_done $testroot $ret
1209 b3c57ab2 2022-03-22 op echo eta > $testroot/wt/eta.expected
1210 b3c57ab2 2022-03-22 op cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1212 b3c57ab2 2022-03-22 op if [ $ret -ne 0 ]; then
1213 b3c57ab2 2022-03-22 op diff -u $testroot/wt/eta.expected $testroot/wt/eta
1215 b3c57ab2 2022-03-22 op test_done $testroot $ret
1218 9d6cabd5 2022-04-07 op test_patch_strip() {
1219 9d6cabd5 2022-04-07 op local testroot=`test_init patch_strip`
1221 9d6cabd5 2022-04-07 op got checkout $testroot/repo $testroot/wt > /dev/null
1223 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1224 9d6cabd5 2022-04-07 op test_done $testroot $ret
1228 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/wt/patch
1229 9d6cabd5 2022-04-07 op --- foo/bar/alpha.orig
1230 9d6cabd5 2022-04-07 op +++ foo/bar/alpha
1236 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p2 patch) > $testroot/stdout
1238 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1239 9d6cabd5 2022-04-07 op test_done $testroot $ret
1243 9d6cabd5 2022-04-07 op echo "M alpha" >> $testroot/stdout.expected
1244 9d6cabd5 2022-04-07 op cmp -s $testroot/stdout.expected $testroot/stdout
1246 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1247 9d6cabd5 2022-04-07 op diff -u $testroot/stdout.expected $testroot/stdout
1248 9d6cabd5 2022-04-07 op test_done $testroot $ret
1252 9d6cabd5 2022-04-07 op (cd $testroot/wt && got revert alpha) > /dev/null 2>&1
1254 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1255 9d6cabd5 2022-04-07 op test_done $testroot $ret
1259 9d6cabd5 2022-04-07 op (cd $testroot/wt && got patch -p3 patch) \
1260 9d6cabd5 2022-04-07 op 2> $testroot/stderr
1262 9d6cabd5 2022-04-07 op if [ $ret -eq 0 ]; then
1263 9d6cabd5 2022-04-07 op echo "stripped more components than available!"
1264 9d6cabd5 2022-04-07 op test_done $testroot 1
1268 9d6cabd5 2022-04-07 op cat <<EOF > $testroot/stderr.expected
1269 9d6cabd5 2022-04-07 op got: can't strip 1 path-components from foo/bar/alpha: bad path
1272 9d6cabd5 2022-04-07 op cmp -s $testroot/stderr.expected $testroot/stderr
1274 9d6cabd5 2022-04-07 op if [ $ret -ne 0 ]; then
1275 9d6cabd5 2022-04-07 op diff -u $testroot/stderr.expected $testroot/stderr
1277 9d6cabd5 2022-04-07 op test_done $testroot 0
1280 a92a2042 2022-07-02 op test_patch_whitespace() {
1281 a92a2042 2022-07-02 op local testroot=`test_init patch_whitespace`
1283 a92a2042 2022-07-02 op got checkout $testroot/repo $testroot/wt > /dev/null
1285 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1286 a92a2042 2022-07-02 op test_done $testroot $ret
1290 a92a2042 2022-07-02 op trailing=" "
1292 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c
1293 a92a2042 2022-07-02 op #include <stdio.h>
1298 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1299 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1304 a92a2042 2022-07-02 op (cd $testroot/wt && got add hello.c && got ci -m '+hello.c') \
1307 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1308 a92a2042 2022-07-02 op test_done $testroot $ret
1312 a92a2042 2022-07-02 op # test with a diff with various whitespace corruptions
1313 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/patch
1316 a92a2042 2022-07-02 op @@ -5,5 +5,5 @@
1318 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1319 a92a2042 2022-07-02 op printf("hello, world\n");
1321 a92a2042 2022-07-02 op + return 5; /* always fails */
1325 a92a2042 2022-07-02 op (cd $testroot/wt && got patch patch) \
1326 a92a2042 2022-07-02 op 2>$testroot/stderr >$testroot/stdout
1328 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1329 a92a2042 2022-07-02 op echo "failed to apply diff" >&2
1330 a92a2042 2022-07-02 op test_done $testroot $ret
1334 a92a2042 2022-07-02 op echo 'M hello.c' > $testroot/stdout.expected
1335 a92a2042 2022-07-02 op echo '@@ -5,5 +5,5 @@ hunk contains mangled whitespace' \
1336 a92a2042 2022-07-02 op >> $testroot/stdout.expected
1337 a92a2042 2022-07-02 op cmp -s $testroot/stdout.expected $testroot/stdout
1339 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1340 a92a2042 2022-07-02 op diff -u $testroot/stdout.expected $testroot/stdout
1341 a92a2042 2022-07-02 op test_done $testroot $ret
1345 a92a2042 2022-07-02 op cat <<EOF > $testroot/wt/hello.c.expected
1346 a92a2042 2022-07-02 op #include <stdio.h>
1351 a92a2042 2022-07-02 op /* the trailing whitespace is on purpose */
1352 a92a2042 2022-07-02 op printf("hello, world\n");$trailing
1353 a92a2042 2022-07-02 op return 5; /* always fails */
1357 a92a2042 2022-07-02 op cmp -s $testroot/wt/hello.c.expected $testroot/wt/hello.c
1359 a92a2042 2022-07-02 op if [ $ret -ne 0 ]; then
1360 a92a2042 2022-07-02 op diff -u $testroot/wt/hello.c.expected $testroot/wt/hello.c
1362 a92a2042 2022-07-02 op test_done $testroot $ret
1365 ed3bff83 2022-04-23 op test_patch_relative_paths() {
1366 f1d6cebb 2022-04-23 op local testroot=`test_init patch_relative_paths`
1368 ed3bff83 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1370 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1371 ed3bff83 2022-04-23 op test_done $testroot $ret
1375 ed3bff83 2022-04-23 op cat <<EOF > $testroot/wt/gamma/patch
1381 ed3bff83 2022-04-23 op --- /dev/null
1383 ed3bff83 2022-04-23 op @@ -0,0 +1 @@
1387 ed3bff83 2022-04-23 op (cd $testroot/wt/gamma && got patch patch) > $testroot/stdout
1389 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1390 ed3bff83 2022-04-23 op test_done $testroot $ret
1394 ed3bff83 2022-04-23 op echo 'M gamma/delta' > $testroot/stdout.expected
1395 ed3bff83 2022-04-23 op echo 'A gamma/eta' >> $testroot/stdout.expected
1397 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1399 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1400 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1402 15e1bda6 2022-04-23 op test_done $testroot $ret
1405 15e1bda6 2022-04-23 op test_patch_with_path_prefix() {
1406 15e1bda6 2022-04-23 op local testroot=`test_init patch_with_path_prefix`
1408 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1410 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1411 15e1bda6 2022-04-23 op test_done $testroot $ret
1415 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1421 15e1bda6 2022-04-23 op --- /dev/null
1423 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1427 15e1bda6 2022-04-23 op (cd $testroot/wt && got patch patch) > $testroot/stdout
1429 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1430 15e1bda6 2022-04-23 op test_done $testroot $ret
1434 15e1bda6 2022-04-23 op echo 'M delta' > $testroot/stdout.expected
1435 15e1bda6 2022-04-23 op echo 'A eta' >> $testroot/stdout.expected
1437 15e1bda6 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1439 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1440 15e1bda6 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1442 15e1bda6 2022-04-23 op test_done $testroot $ret
1445 15e1bda6 2022-04-23 op test_patch_relpath_with_path_prefix() {
1446 15e1bda6 2022-04-23 op local testroot=`test_init patch_relpaths_with_path_prefix`
1448 15e1bda6 2022-04-23 op got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1450 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1451 15e1bda6 2022-04-23 op test_done $testroot $ret
1455 15e1bda6 2022-04-23 op mkdir -p $testroot/wt/epsilon/zeta/
1457 15e1bda6 2022-04-23 op cat <<EOF > $testroot/wt/patch
1458 15e1bda6 2022-04-23 op --- /dev/null
1459 15e1bda6 2022-04-23 op +++ zeta/theta
1460 15e1bda6 2022-04-23 op @@ -0,0 +1 @@
1464 15e1bda6 2022-04-23 op (cd $testroot/wt/epsilon/zeta && got patch -p1 $testroot/wt/patch) \
1465 15e1bda6 2022-04-23 op > $testroot/stdout
1467 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1468 15e1bda6 2022-04-23 op test_done $testroot $ret
1472 15e1bda6 2022-04-23 op echo 'A epsilon/zeta/theta' >> $testroot/stdout.expected
1474 ed3bff83 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1476 ed3bff83 2022-04-23 op if [ $ret -ne 0 ]; then
1477 ed3bff83 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1478 15e1bda6 2022-04-23 op test_done $testroot $ret
1482 15e1bda6 2022-04-23 op echo 'theta' > $testroot/theta.expected
1483 15e1bda6 2022-04-23 op cmp -s $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1485 15e1bda6 2022-04-23 op if [ $ret -ne 0 ]; then
1486 15e1bda6 2022-04-23 op diff -u $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1488 ed3bff83 2022-04-23 op test_done $testroot $ret
1491 bad961bf 2022-04-23 op test_patch_reverse() {
1492 bad961bf 2022-04-23 op local testroot=`test_init patch_reverse`
1494 bad961bf 2022-04-23 op got checkout $testroot/repo $testroot/wt > /dev/null
1496 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1497 bad961bf 2022-04-23 op test_done $testroot $ret
1501 bad961bf 2022-04-23 op cat <<EOF > $testroot/wt/patch
1506 bad961bf 2022-04-23 op \ No newline at end of file
1510 bad961bf 2022-04-23 op (cd $testroot/wt && got patch -R patch) > $testroot/stdout
1512 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1513 bad961bf 2022-04-23 op test_done $testroot $ret
1517 bad961bf 2022-04-23 op echo "M alpha" > $testroot/stdout.expected
1518 bad961bf 2022-04-23 op cmp -s $testroot/stdout.expected $testroot/stdout
1520 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1521 bad961bf 2022-04-23 op diff -u $testroot/stdout.expected $testroot/stdout
1522 bad961bf 2022-04-23 op test_done $testroot $ret
1526 bad961bf 2022-04-23 op echo -n ALPHA > $testroot/wt/alpha.expected
1527 bad961bf 2022-04-23 op cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
1529 bad961bf 2022-04-23 op if [ $ret -ne 0 ]; then
1530 bad961bf 2022-04-23 op diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
1532 55e9459f 2022-06-19 op test_done $testroot $ret
1535 55e9459f 2022-06-19 op test_patch_merge_simple() {
1536 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_simple`
1538 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1540 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1541 55e9459f 2022-06-19 op test_done $testroot $ret
1545 55e9459f 2022-06-19 op jot 10 > $testroot/wt/numbers
1546 5dffb1a1 2022-07-02 op chmod +x $testroot/wt/numbers
1547 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1550 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1551 55e9459f 2022-06-19 op test_done $testroot $ret
1555 55e9459f 2022-06-19 op jot 10 | sed 's/4/four/g' > $testroot/wt/numbers
1557 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1558 55e9459f 2022-06-19 op && got revert numbers) >/dev/null
1560 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1561 55e9459f 2022-06-19 op test_done $testroot $ret
1565 55e9459f 2022-06-19 op jot 10 | sed 's/6/six/g' > $testroot/wt/numbers
1566 55e9459f 2022-06-19 op (cd $testroot/wt && got commit -m 'edit numbers') \
1569 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1570 55e9459f 2022-06-19 op test_done $testroot $ret
1574 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1575 9802c41c 2022-06-21 op > $testroot/stdout
1577 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1578 9802c41c 2022-06-21 op test_done $testroot $ret
1582 9802c41c 2022-06-21 op echo 'G numbers' > $testroot/stdout.expected
1583 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1585 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1586 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1587 55e9459f 2022-06-19 op test_done $testroot $ret
1591 55e9459f 2022-06-19 op jot 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1592 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1594 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1595 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1596 5dffb1a1 2022-07-02 op test_done $testroot $ret
1600 5dffb1a1 2022-07-02 op test -x $testroot/wt/numbers
1602 5dffb1a1 2022-07-02 op if [ $ret -ne 0 ]; then
1603 5dffb1a1 2022-07-02 op echo "numbers lost the executable bit" >&2
1605 db0dfdd7 2022-06-27 op test_done $testroot $ret
1608 db0dfdd7 2022-06-27 op test_patch_merge_gitdiff() {
1609 db0dfdd7 2022-06-27 op local testroot=`test_init patch_merge_gitdiff`
1611 db0dfdd7 2022-06-27 op jot 10 > $testroot/repo/numbers
1612 db0dfdd7 2022-06-27 op (cd $testroot/repo && git add numbers && \
1613 db0dfdd7 2022-06-27 op git_commit $testroot/repo -m "nums")
1615 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1616 db0dfdd7 2022-06-27 op test_done $testroot $ret
1620 db0dfdd7 2022-06-27 op jot 10 | sed 's/4/four/g' > $testroot/repo/numbers
1621 db0dfdd7 2022-06-27 op (cd $testroot/repo && git diff > $testroot/old.diff)
1623 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1624 db0dfdd7 2022-06-27 op test_done $testroot $ret
1628 db0dfdd7 2022-06-27 op # restore numbers
1629 db0dfdd7 2022-06-27 op jot 10 > $testroot/repo/numbers
1631 db0dfdd7 2022-06-27 op jot 10 | sed 's/6/six/g' > $testroot/repo/numbers
1632 db0dfdd7 2022-06-27 op (cd $testroot/repo && git add numbers && \
1633 db0dfdd7 2022-06-27 op git_commit $testroot/repo -m "edit")
1635 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1636 db0dfdd7 2022-06-27 op test_done $testroot $ret
1640 db0dfdd7 2022-06-27 op # now work with got:
1641 db0dfdd7 2022-06-27 op got checkout $testroot/repo $testroot/wt > /dev/null
1643 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1644 db0dfdd7 2022-06-27 op test_done $testroot $ret
1648 db0dfdd7 2022-06-27 op (cd $testroot/wt && got patch $testroot/old.diff) > $testroot/stdout
1650 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1651 db0dfdd7 2022-06-27 op test_done $testroot $ret
1655 db0dfdd7 2022-06-27 op echo 'G numbers' > $testroot/stdout.expected
1656 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout $testroot/stdout.expected
1658 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1659 db0dfdd7 2022-06-27 op diff -u $testroot/stdout $testroot/stdout.expected
1661 55e9459f 2022-06-19 op test_done $testroot $ret
1664 55e9459f 2022-06-19 op test_patch_merge_conflict() {
1665 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_conflict`
1667 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1669 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1670 55e9459f 2022-06-19 op test_done $testroot $ret
1674 55e9459f 2022-06-19 op jot 10 > $testroot/wt/numbers
1675 55e9459f 2022-06-19 op (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1678 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1679 55e9459f 2022-06-19 op test_done $testroot $ret
1683 d8b5af43 2022-06-19 op local commit_id=`git_show_head $testroot/repo`
1685 55e9459f 2022-06-19 op jot 10 | sed 's/6/six/g' > $testroot/wt/numbers
1686 acf749fc 2022-07-02 op echo ALPHA > $testroot/wt/alpha
1688 55e9459f 2022-06-19 op (cd $testroot/wt && got diff > $testroot/old.diff \
1689 acf749fc 2022-07-02 op && got revert alpha numbers) >/dev/null
1691 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1692 55e9459f 2022-06-19 op test_done $testroot $ret
1696 55e9459f 2022-06-19 op jot 10 | sed 's/6/3+3/g' > $testroot/wt/numbers
1697 acf749fc 2022-07-02 op jot -c 3 a > $testroot/wt/alpha
1698 acf749fc 2022-07-02 op (cd $testroot/wt && got commit -m 'edit alpha and numbers') \
1701 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1702 55e9459f 2022-06-19 op test_done $testroot $ret
1706 55e9459f 2022-06-19 op (cd $testroot/wt && got patch $testroot/old.diff) \
1707 9802c41c 2022-06-21 op > $testroot/stdout 2>/dev/null
1709 55e9459f 2022-06-19 op if [ $ret -eq 0 ]; then
1710 55e9459f 2022-06-19 op echo "got patch merged a diff that should conflict" >&2
1711 55e9459f 2022-06-19 op test_done $testroot 0
1715 acf749fc 2022-07-02 op echo 'C alpha' > $testroot/stdout.expected
1716 acf749fc 2022-07-02 op echo 'C numbers' >> $testroot/stdout.expected
1717 9802c41c 2022-06-21 op cmp -s $testroot/stdout $testroot/stdout.expected
1719 9802c41c 2022-06-21 op if [ $ret -ne 0 ]; then
1720 9802c41c 2022-06-21 op diff -u $testroot/stdout $testroot/stdout.expected
1721 9802c41c 2022-06-21 op test_done $testroot $ret
1725 55e9459f 2022-06-19 op # XXX: prefixing every line with a tab otherwise got thinks
1726 55e9459f 2022-06-19 op # the file has conflicts in it.
1727 acf749fc 2022-07-02 op cat <<-EOF > $testroot/wt/alpha.expected
1728 acf749fc 2022-07-02 op <<<<<<< --- alpha
1730 acf749fc 2022-07-02 op ||||||| commit $commit_id
1736 acf749fc 2022-07-02 op >>>>>>> +++ alpha
1739 55e9459f 2022-06-19 op cat <<-EOF > $testroot/wt/numbers.expected
1745 55e9459f 2022-06-19 op <<<<<<< --- numbers
1747 d8b5af43 2022-06-19 op ||||||| commit $commit_id
1751 55e9459f 2022-06-19 op >>>>>>> +++ numbers
1758 acf749fc 2022-07-02 op cmp -s $testroot/wt/alpha $testroot/wt/alpha.expected
1760 acf749fc 2022-07-02 op if [ $ret -ne 0 ]; then
1761 acf749fc 2022-07-02 op diff -u $testroot/wt/alpha $testroot/wt/alpha.expected
1762 acf749fc 2022-07-02 op test_done $testroot $ret
1766 55e9459f 2022-06-19 op cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1768 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1769 55e9459f 2022-06-19 op diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1771 bad961bf 2022-04-23 op test_done $testroot $ret
1774 55e9459f 2022-06-19 op test_patch_merge_unknown_blob() {
1775 55e9459f 2022-06-19 op local testroot=`test_init patch_merge_unknown_blob`
1777 55e9459f 2022-06-19 op got checkout $testroot/repo $testroot/wt > /dev/null
1779 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1780 55e9459f 2022-06-19 op test_done $testroot $ret
1784 55e9459f 2022-06-19 op cat <<EOF > $testroot/wt/patch
1786 dbc68eed 2022-06-21 op diff aaaabbbbccccddddeeeeffff0000111122223333 foo/bar
1788 55e9459f 2022-06-19 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1790 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1791 55e9459f 2022-06-19 op for this dummy diff
1797 55e9459f 2022-06-19 op will it work?
1800 55e9459f 2022-06-19 op (cd $testroot/wt/ && got patch patch) > $testroot/stdout
1802 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1803 55e9459f 2022-06-19 op test_done $testroot $ret
1807 55e9459f 2022-06-19 op echo 'M alpha' > $testroot/stdout.expected
1808 55e9459f 2022-06-19 op cmp -s $testroot/stdout.expected $testroot/stdout
1810 55e9459f 2022-06-19 op if [ $ret -ne 0 ]; then
1811 55e9459f 2022-06-19 op diff -u $testroot/stdout.expected $testroot/stdout
1812 dbc68eed 2022-06-21 op test_done $testroot $ret
1816 dbc68eed 2022-06-21 op # try again without a `diff' header
1818 dbc68eed 2022-06-21 op cat <<EOF > $testroot/wt/patch
1820 dbc68eed 2022-06-21 op blob - aaaabbbbccccddddeeeeffff0000111122223333
1822 dbc68eed 2022-06-21 op blob + 0000111122223333444455556666777788889999
1823 dbc68eed 2022-06-21 op for this dummy diff
1829 dbc68eed 2022-06-21 op will it work?
1832 dbc68eed 2022-06-21 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1833 dbc68eed 2022-06-21 op > $testroot/stdout
1835 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1836 dbc68eed 2022-06-21 op test_done $testroot $ret
1840 dbc68eed 2022-06-21 op echo 'M alpha' > $testroot/stdout.expected
1841 dbc68eed 2022-06-21 op cmp -s $testroot/stdout.expected $testroot/stdout
1843 dbc68eed 2022-06-21 op if [ $ret -ne 0 ]; then
1844 dbc68eed 2022-06-21 op diff -u $testroot/stdout.expected $testroot/stdout
1845 db0dfdd7 2022-06-27 op test_done $testroot $ret
1849 db0dfdd7 2022-06-27 op # try again with a git-style diff
1851 db0dfdd7 2022-06-27 op cat <<EOF > $testroot/wt/patch
1852 db0dfdd7 2022-06-27 op diff --git a/alpha b/alpha
1853 db0dfdd7 2022-06-27 op index 0123456789ab..abcdef012345 100644
1861 db0dfdd7 2022-06-27 op (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1862 db0dfdd7 2022-06-27 op > $testroot/stdout
1864 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1865 db0dfdd7 2022-06-27 op test_done $testroot $ret
1869 db0dfdd7 2022-06-27 op echo 'M alpha' > $testroot/stdout.expected
1870 db0dfdd7 2022-06-27 op cmp -s $testroot/stdout.expected $testroot/stdout
1872 db0dfdd7 2022-06-27 op if [ $ret -ne 0 ]; then
1873 db0dfdd7 2022-06-27 op diff -u $testroot/stdout.expected $testroot/stdout
1875 55e9459f 2022-06-19 op test_done $testroot $ret
1878 e9ce266e 2022-03-07 op test_parseargs "$@"
1879 ed2ff8b9 2022-07-02 op run_test test_patch_add_file
1880 f5b0315f 2022-07-02 op run_test test_patch_rm_file
1881 e9ce266e 2022-03-07 op run_test test_patch_simple_edit_file
1882 e9ce266e 2022-03-07 op run_test test_patch_prepend_line
1883 e9ce266e 2022-03-07 op run_test test_patch_replace_line
1884 e9ce266e 2022-03-07 op run_test test_patch_multiple_hunks
1885 e9ce266e 2022-03-07 op run_test test_patch_multiple_files
1886 e9ce266e 2022-03-07 op run_test test_patch_dont_apply
1887 e9ce266e 2022-03-07 op run_test test_patch_malformed
1888 e9ce266e 2022-03-07 op run_test test_patch_no_patch
1889 e9ce266e 2022-03-07 op run_test test_patch_equals_for_context
1890 6e96b326 2022-03-12 op run_test test_patch_rename
1891 dbda770b 2022-03-13 op run_test test_patch_illegal_status
1892 899fcfdf 2022-03-13 op run_test test_patch_nop
1893 2be5e1a2 2022-03-16 op run_test test_patch_preserve_perm
1894 95d68340 2022-03-16 op run_test test_patch_create_dirs
1895 60aa1fa0 2022-03-17 op run_test test_patch_with_offset
1896 7a30b5cb 2022-03-20 op run_test test_patch_prefer_new_path
1897 b3c57ab2 2022-03-22 op run_test test_patch_no_newline
1898 9d6cabd5 2022-04-07 op run_test test_patch_strip
1899 a92a2042 2022-07-02 op run_test test_patch_whitespace
1900 ed3bff83 2022-04-23 op run_test test_patch_relative_paths
1901 15e1bda6 2022-04-23 op run_test test_patch_with_path_prefix
1902 15e1bda6 2022-04-23 op run_test test_patch_relpath_with_path_prefix
1903 bad961bf 2022-04-23 op run_test test_patch_reverse
1904 55e9459f 2022-06-19 op run_test test_patch_merge_simple
1905 db0dfdd7 2022-06-27 op run_test test_patch_merge_gitdiff
1906 55e9459f 2022-06-19 op run_test test_patch_merge_conflict
1907 55e9459f 2022-06-19 op run_test test_patch_merge_unknown_blob