3 # Copyright (c) 2022 Omar Polo <op@openbsd.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 local testroot=`test_init patch_basic`
22 got checkout $testroot/repo $testroot/wt > /dev/null
24 if [ $ret -ne 0 ]; then
25 test_done $testroot $ret
29 seq 100 > $testroot/wt/numbers
30 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
33 if [ $ret -ne 0 ]; then
34 test_done "$testroot" $ret
38 cat <<EOF > $testroot/wt/patch
43 +alpha is my favourite character
90 (cd $testroot/wt && got patch < patch) > $testroot/stdout
91 if [ $ret -ne 0 ]; then
92 test_done "$testroot" $ret
96 echo 'M alpha' > $testroot/stdout.expected
97 echo 'D beta' >> $testroot/stdout.expected
98 echo 'M gamma/delta' >> $testroot/stdout.expected
99 echo 'A eta' >> $testroot/stdout.expected
100 echo 'M numbers' >> $testroot/stdout.expected
102 cmp -s $testroot/stdout.expected $testroot/stdout
104 if [ $ret -ne 0 ]; then
105 diff -u $testroot/stdout.expected $testroot/stdout
106 test_done $testroot $ret
110 echo 'alpha is my favourite character' > $testroot/wt/alpha.expected
111 cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
113 if [ $ret -ne 0 ]; then
114 diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
115 test_done "$testroot" $ret
119 if [ -f "$testroot/wt/beta" ]; then
120 echo "beta was not deleted!" >&2
121 test_done "$testroot" 1
125 echo 'this is:' > $testroot/wt/gamma/delta.expected
126 echo 'delta' >> $testroot/wt/gamma/delta.expected
127 cmp -s $testroot/wt/gamma/delta.expected $testroot/wt/gamma/delta
129 if [ $ret -ne 0 ]; then
130 diff -u $testroot/wt/gamma/delta.expected $testroot/wt/gamma/delta
131 test_done "$testroot" $ret
135 seq 5 > $testroot/wt/eta.expected
136 cmp -s $testroot/wt/eta.expected $testroot/wt/eta
138 if [ $ret -ne 0 ]; then
139 diff -u $testroot/wt/eta.expected $testroot/wt/eta
140 test_done "$testroot" $ret
144 seq 103 | sed -e 's/^6$/six/' -e 's/60/sixty/' \
145 > $testroot/wt/numbers.expected
146 cmp -s $testroot/wt/numbers.expected $testroot/wt/numbers
148 if [ $ret -ne 0 ]; then
149 diff -u $testroot/wt/numbers.expected $testroot/wt/numbers
151 test_done $testroot $ret
154 test_patch_dont_apply() {
155 local testroot=`test_init patch_dont_apply`
157 got checkout $testroot/repo $testroot/wt > /dev/null
159 if [ $ret -ne 0 ]; then
160 test_done $testroot $ret
164 seq 100 > $testroot/wt/numbers
165 (cd $testroot/wt && got add numbers && got commit -m 'add numbers') \
168 if [ $ret -ne 0 ]; then
169 test_done $testroot $ret
173 cat <<EOF > $testroot/wt/patch
193 (cd $testroot/wt && got patch patch) > $testroot/stdout 2> /dev/null
195 if [ $ret -eq 0 ]; then # should fail
196 test_done $testroot 1
200 cat <<EOF > $testroot/stdout.expected
202 @@ -1,1 +1,2 @@ hunk failed to apply
204 @@ -1,9 +0,0 @@ hunk failed to apply
205 Files where patch failed to apply: 2
208 cmp -s $testroot/stdout.expected $testroot/stdout
210 if [ $ret -ne 0 ]; then
211 diff -u $testroot/stdout.expected $testroot/stdout
213 test_done $testroot $ret
216 test_patch_malformed() {
217 local testroot=`test_init patch_malformed`
219 got checkout $testroot/repo $testroot/wt > /dev/null
221 if [ $ret -ne 0 ]; then
222 test_done $testroot $ret
227 cat <<EOF > $testroot/wt/patch
235 echo -n > $testroot/stdout.expected
236 echo "got: malformed patch" > $testroot/stderr.expected
238 (cd $testroot/wt && got patch patch) \
242 if [ $ret -eq 0 ]; then
243 echo "got managed to apply an invalid patch"
244 test_done $testroot 1
248 cmp -s $testroot/stdout.expected $testroot/stdout
250 if [ $ret -ne 0 ]; then
251 diff -u $testroot/stdout.expected $testroot/stdout
252 test_done $testroot $ret
256 cmp -s $testroot/stderr.expected $testroot/stderr
258 if [ $ret -ne 0 ]; then
259 diff -u $testroot/stderr.expected $testroot/stderr
260 test_done $testroot $ret
264 # wrong first character
265 cat <<EOF > $testroot/wt/patch
273 (cd $testroot/wt && got patch patch) \
277 if [ $ret -eq 0 ]; then
278 echo "got managed to apply an invalid patch"
279 test_done $testroot 1
283 cmp -s $testroot/stdout.expected $testroot/stdout
285 if [ $ret -ne 0 ]; then
286 diff -u $testroot/stdout.expected $testroot/stdout
287 test_done $testroot $ret
291 cmp -s $testroot/stderr.expected $testroot/stderr
293 if [ $ret -ne 0 ]; then
294 diff -u $testroot/stderr.expected $testroot/stderr
295 test_done $testroot $ret
300 cat <<EOF > $testroot/wt/patch
301 diff --git a/alpha b/iota
307 (cd $testroot/wt && got patch patch) \
311 if [ $ret -eq 0 ]; then
312 echo "got managed to apply an invalid patch"
313 test_done $testroot 1
317 cmp -s $testroot/stdout.expected $testroot/stdout
319 if [ $ret -ne 0 ]; then
320 diff -u $testroot/stdout.expected $testroot/stdout
321 test_done $testroot $ret
325 cmp -s $testroot/stderr.expected $testroot/stderr
327 if [ $ret -ne 0 ]; then
328 diff -u $testroot/stderr.expected $testroot/stderr
329 test_done $testroot $ret
333 test_done $testroot $ret
336 test_patch_no_patch() {
337 local testroot=`test_init patch_no_patch`
339 got checkout $testroot/repo $testroot/wt > /dev/null
341 if [ $ret -ne 0 ]; then
342 test_done $testroot $ret
346 cat <<EOF > $testroot/wt/patch
353 there's no patch in here!
356 echo -n > $testroot/stdout.expected
357 echo "got: no patch found" > $testroot/stderr.expected
359 (cd $testroot/wt && got patch patch) \
363 if [ $ret -eq 0 ]; then # should fail
364 test_done $testroot 1
368 cmp -s $testroot/stdout.expected $testroot/stdout
370 if [ $ret -ne 0 ]; then
371 diff -u $testroot/stdout.expected $testroot/stdout
372 test_done $testroot $ret
376 cmp -s $testroot/stderr.expected $testroot/stderr
378 if [ $ret -ne 0 ]; then
379 diff -u $testroot/stderr.expected $testroot/stderr
380 test_done $testroot $ret
384 test_done $testroot $ret
387 test_patch_equals_for_context() {
388 local testroot=`test_init patch_equals_for_context`
390 got checkout $testroot/repo $testroot/wt > /dev/null
392 if [ $ret -ne 0 ]; then
393 test_done $testroot $ret
397 cat <<EOF > $testroot/wt/patch
405 echo "M alpha" > $testroot/stdout.expected
407 (cd $testroot/wt && got patch patch) > $testroot/stdout
409 if [ $ret -ne 0 ]; then
410 test_done $testroot $ret
414 cmp -s $testroot/stdout.expected $testroot/stdout
416 if [ $ret -ne 0 ]; then
417 diff -u $testroot/stdout.expected $testroot/stdout
418 test_done $testroot $ret
422 echo hatsuseno > $testroot/wt/alpha.expected
423 echo alpha >> $testroot/wt/alpha.expected
424 cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
426 if [ $ret -ne 0 ]; then
427 diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
429 test_done $testroot $ret
432 test_patch_rename() {
433 local testroot=`test_init patch_rename`
435 got checkout $testroot/repo $testroot/wt > /dev/null
437 if [ $ret -ne 0 ]; then
438 test_done $testroot $ret
442 cat <<EOF > $testroot/wt/patch
443 diff --git a/beta b/iota
444 similarity index 100%
447 diff --git a/alpha b/eta
455 echo 'D beta' > $testroot/stdout.expected
456 echo 'A iota' >> $testroot/stdout.expected
457 echo 'D alpha' >> $testroot/stdout.expected
458 echo 'A eta' >> $testroot/stdout.expected
460 (cd $testroot/wt && got patch patch) > $testroot/stdout
462 if [ $ret -ne 0 ]; then
463 test_done $testroot $ret
467 cmp -s $testroot/stdout.expected $testroot/stdout
469 if [ $ret -ne 0 ]; then
470 diff -u $testroot/stdout.expected $testroot/stdout
471 test_done $testroot $ret
475 if [ -f $testroot/wt/alpha -o -f $testroot/wt/beta ]; then
476 echo "alpha or beta were not removed" >&2
477 test_done $testroot 1
480 if [ ! -f $testroot/wt/iota -o ! -f $testroot/wt/eta ]; then
481 echo "iota or eta were not created" >&2
482 test_done $testroot 1
486 echo beta > $testroot/wt/iota.expected
487 cmp -s $testroot/wt/iota.expected $testroot/wt/iota
489 if [ $ret -ne 0 ]; then
490 diff -u $testroot/wt/iota.expected $testroot/wt/iota
491 test_done $testroot $ret
495 echo eta > $testroot/wt/eta.expected
496 cmp -s $testroot/wt/eta.expected $testroot/wt/eta
498 if [ $ret -ne 0 ]; then
499 diff -u $testroot/wt/eta.expected $testroot/wt/eta
500 test_done $testroot $ret
504 test_done $testroot $ret
507 test_patch_illegal_status() {
508 local testroot=`test_init patch_illegal_status`
510 got checkout $testroot/repo $testroot/wt > /dev/null
512 if [ $ret -ne 0 ]; then
513 test_done $testroot $ret
517 # try to patch an obstructed file, add a versioned one, edit a
518 # non existent file and an unversioned one, and remove a
520 cat <<EOF > $testroot/wt/patch
546 echo kappa > $testroot/wt/kappa
547 rm $testroot/wt/alpha
548 mkdir $testroot/wt/alpha
550 (cd $testroot/wt && got patch patch) > $testroot/stdout \
553 if [ $ret -eq 0 ]; then
554 echo "edited a missing file" >&2
555 test_done $testroot 1
559 cat <<EOF > $testroot/stdout.expected
565 Files where patch failed to apply: 5
568 cat <<EOF > $testroot/stderr.expected
569 got: alpha: file has unexpected status
570 got: beta: file has unexpected status
571 got: iota: No such file or directory
572 got: kappa: file has unexpected status
573 got: lambda: No such file or directory
574 got: patch failed to apply
577 cmp -s $testroot/stdout.expected $testroot/stdout
579 if [ $ret -ne 0 ]; then
580 diff -u $testroot/stdout.expected $testroot/stdout
581 test_done $testroot $ret
585 cmp -s $testroot/stderr.expected $testroot/stderr
587 if [ $ret -ne 0 ]; then
588 diff -u $testroot/stderr.expected $testroot/stderr
589 test_done $testroot $ret
593 (cd $testroot/wt && got status) > $testroot/stdout
594 cat <<EOF > $testroot/stdout.expected
600 cmp -s $testroot/stdout.expected $testroot/stdout
602 if [ $ret -ne 0 ]; then
603 diff -u $testroot/stdout.expected $testroot/stdout
605 test_done $testroot $ret
609 local testroot=`test_init patch_nop`
611 got checkout $testroot/repo $testroot/wt > /dev/null
613 if [ $ret -ne 0 ]; then
614 test_done $testroot $ret
618 cat <<EOF > $testroot/wt/patch
628 diff --git a/gamma/delta b/gamma/delta.new
633 +delta updated and renamed!
636 (cd $testroot/wt && got patch -n patch)
638 if [ $ret -ne 0 ]; then
639 test_done $testroot $ret
643 # remove the patch to avoid the ? entry
644 rm $testroot/wt/patch
646 (cd $testroot/wt && got status) > $testroot/stdout
648 if [ $ret -ne 0 ]; then
649 test_done $testroot $ret
653 echo -n > $testroot/stdout.expected
654 cmp -s $testroot/stdout.expected $testroot/stdout
656 if [ $ret -ne 0 ]; then
657 diff -u $testroot/stdout.expected $testroot/stdout
659 test_done $testroot $ret
662 test_patch_preserve_perm() {
663 local testroot=`test_init patch_preserve_perm`
665 got checkout $testroot/repo $testroot/wt > /dev/null
667 if [ $ret -ne 0 ]; then
668 test_done $testroot $ret
672 chmod +x $testroot/wt/alpha
673 (cd $testroot/wt && got commit -m 'alpha executable') > /dev/null
675 if [ $ret -ne 0 ]; then
676 test_done $testroot $ret
680 cat <<EOF > $testroot/wt/patch
688 (cd $testroot/wt && got patch patch) > /dev/null
690 if [ $ret -ne 0 ]; then
691 test_done $testroot $ret
695 if [ ! -x $testroot/wt/alpha ]; then
696 echo "alpha is no more executable!" >&2
697 test_done $testroot 1
700 test_done $testroot 0
703 test_patch_create_dirs() {
704 local testroot=`test_init patch_create_dirs`
706 got checkout $testroot/repo $testroot/wt > /dev/null
708 if [ $ret -ne 0 ]; then
709 test_done $testroot $ret
713 cat <<EOF > $testroot/wt/patch
715 +++ iota/kappa/lambda
720 (cd $testroot/wt && got patch patch) > $testroot/stdout
722 if [ $ret -ne 0 ]; then
723 test_done $testroot $ret
727 echo 'A iota/kappa/lambda' >> $testroot/stdout.expected
728 cmp -s $testroot/stdout.expected $testroot/stdout
730 if [ $ret -ne 0 ]; then
731 diff -u $testroot/stdout.expected $testroot/stdout
732 test_done $testroot $ret
736 if [ ! -f $testroot/wt/iota/kappa/lambda ]; then
737 echo "file not created!" >&2
738 test_done $testroot $ret
741 test_done $testroot 0
744 test_patch_with_offset() {
745 local testroot=`test_init patch_with_offset`
747 got checkout $testroot/repo $testroot/wt > /dev/null
749 if [ $ret -ne 0 ]; then
750 test_done $testroot $ret
754 cat <<EOF > $testroot/wt/patch
777 seq 100 > $testroot/wt/numbers
778 ed -s "$testroot/wt/numbers" <<EOF
785 (cd $testroot/wt && got add numbers && got commit -m '+numbers') \
788 if [ $ret -ne 0 ]; then
789 test_done $testroot $ret
793 (cd $testroot/wt && got patch patch) > $testroot/stdout
795 if [ $ret -ne 0 ]; then
796 test_done $testroot/wt $ret
800 cat <<EOF > $testroot/stdout.expected
802 @@ -47,7 +47,7 @@ applied with offset -10
803 @@ -87,7 +87,7 @@ applied with offset 10
806 cmp -s $testroot/stdout.expected $testroot/stdout
808 if [ $ret -ne 0 ]; then
809 diff -u $testroot/stdout.expected $testroot/stdout
811 test_done $testroot $ret
814 test_patch_empty_file() {
815 local testroot=`test_init patch_empty_file`
817 got checkout $testroot/repo $testroot/wt > /dev/null
819 if [ $ret -ne 0 ]; then
820 test_done $testroot $ret
824 echo -n > $testroot/wt/alpha
825 (cd "$testroot/wt" && got commit -m 'edit alpha' alpha) >/dev/null
827 # try a patch which re-adds file contents; should suceeed
828 cat <<EOF >$testroot/wt/patch
834 (cd $testroot/wt && got patch patch) > $testroot/stdout
836 if [ $ret -ne 0 ]; then
837 test_done $testroot $ret
840 echo 'M alpha' > $testroot/stdout.expected
841 cmp -s $testroot/stdout.expected $testroot/stdout
843 if [ $ret -ne 0 ]; then
844 diff -u $testroot/stdout.expected $testroot/stdout
845 test_done $testroot $ret
849 (cd $testroot/wt && got revert -R . > /dev/null)
851 # try a patch which edits the file; should fail
852 cat <<EOF >$testroot/wt/patch
859 (cd $testroot/wt && got patch patch) > $testroot/stdout \
862 if [ $ret -eq 0 ]; then
863 echo "got patch suceeded unexpectedly" >&2
864 test_done $testroot $ret
868 echo 'got: patch failed to apply' > $testroot/stderr.expected
869 cmp -s $testroot/stderr.expected $testroot/stderr
871 if [ $ret -ne 0 ]; then
872 diff -u $testroot/stderr.expected $testroot/stderr
873 test_done $testroot $ret
877 (cd $testroot/wt && got revert -R . > /dev/null)
879 # try a patch which deletes lines from the file; should fail
880 cat <<EOF >$testroot/wt/patch
887 (cd $testroot/wt && got patch patch) > $testroot/stdout \
890 if [ $ret -eq 0 ]; then
891 echo "got patch suceeded unexpectedly" >&2
892 test_done $testroot $ret
895 echo 'got: patch failed to apply' > $testroot/stderr.expected
896 cmp -s $testroot/stderr.expected $testroot/stderr
898 if [ $ret -ne 0 ]; then
899 diff -u $testroot/stderr.expected $testroot/stderr
901 test_done $testroot $ret
904 test_patch_prefer_new_path() {
905 local testroot=`test_init patch_orig`
907 got checkout $testroot/repo $testroot/wt > /dev/null
909 if [ $ret -ne 0 ]; then
910 test_done $testroot $ret
914 cat <<EOF > $testroot/wt/patch
922 (cd $testroot/wt && got patch patch) > $testroot/stdout
924 if [ $ret -ne 0 ]; then
925 test_done $testroot $ret
929 echo 'M alpha' > $testroot/stdout.expected
930 cmp -s $testroot/stdout.expected $testroot/stdout
932 if [ $ret -ne 0 ]; then
933 diff -u $testroot/stdout.expected $testroot/stdout
935 test_done $testroot $ret
938 test_patch_no_newline() {
939 local testroot=`test_init patch_no_newline`
941 got checkout $testroot/repo $testroot/wt > /dev/null
943 if [ $ret -ne 0 ]; then
944 test_done $testroot $ret
948 cat <<EOF > $testroot/wt/patch
953 \ No newline at end of file
956 (cd $testroot/wt && got patch patch) > $testroot/stdout
958 if [ $ret -ne 0 ]; then
959 test_done $testroot $ret
963 echo "A eta" > $testroot/stdout.expected
964 cmp -s $testroot/stdout.expected $testroot/stdout
966 if [ $ret -ne 0 ]; then
967 diff -u $testroot/stdout.expected $testroot/stdout
968 test_done $testroot $ret
972 echo -n eta > $testroot/wt/eta.expected
973 cmp -s $testroot/wt/eta.expected $testroot/wt/eta
975 if [ $ret -ne 0 ]; then
976 diff -u $testroot/wt/eta.expected $testroot/wt/eta
977 test_done $testroot $ret
981 (cd $testroot/wt && got commit -m 'add eta') > /dev/null
983 if [ $ret -ne 0 ]; then
984 test_done $testroot $ret
988 cat <<EOF > $testroot/wt/patch
993 \ No newline at end of file
995 \ No newline at end of file
998 (cd $testroot/wt && got patch patch) > $testroot/stdout
1000 if [ $ret -ne 0 ]; then
1001 test_done $testroot $ret
1005 echo "M eta" > $testroot/stdout.expected
1006 cmp -s $testroot/stdout.expected $testroot/stdout
1008 if [ $ret -ne 0 ]; then
1009 diff -u $testroot/stdout.expected $testroot/stdout
1010 test_done $testroot $ret
1014 echo -n ETA > $testroot/wt/eta.expected
1015 cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1017 if [ $ret -ne 0 ]; then
1018 diff -u $testroot/wt/eta.expected $testroot/wt/eta
1019 test_done $testroot $ret
1023 (cd $testroot/wt && got commit -m 'edit eta') > /dev/null
1025 if [ $ret -ne 0 ]; then
1026 test_done $testroot $ret
1030 cat <<EOF > $testroot/wt/patch
1035 \ No newline at end of file
1039 (cd $testroot/wt && got patch patch) > $testroot/stdout
1041 if [ $ret -ne 0 ]; then
1042 test_done $testroot $ret
1046 echo "M eta" > $testroot/stdout.expected
1047 cmp -s $testroot/stdout.expected $testroot/stdout
1049 if [ $ret -ne 0 ]; then
1050 diff -u $testroot/stdout.expected $testroot/stdout
1051 test_done $testroot $ret
1055 echo eta > $testroot/wt/eta.expected
1056 cmp -s $testroot/wt/eta.expected $testroot/wt/eta
1058 if [ $ret -ne 0 ]; then
1059 diff -u $testroot/wt/eta.expected $testroot/wt/eta
1061 test_done $testroot $ret
1064 test_patch_strip() {
1065 local testroot=`test_init patch_strip`
1067 got checkout $testroot/repo $testroot/wt > /dev/null
1069 if [ $ret -ne 0 ]; then
1070 test_done $testroot $ret
1074 cat <<EOF > $testroot/wt/patch
1075 --- foo/bar/alpha.orig
1082 (cd $testroot/wt && got patch -p2 patch) > $testroot/stdout
1084 if [ $ret -ne 0 ]; then
1085 test_done $testroot $ret
1089 echo "M alpha" >> $testroot/stdout.expected
1090 cmp -s $testroot/stdout.expected $testroot/stdout
1092 if [ $ret -ne 0 ]; then
1093 diff -u $testroot/stdout.expected $testroot/stdout
1094 test_done $testroot $ret
1098 (cd $testroot/wt && got revert alpha) > /dev/null 2>&1
1100 if [ $ret -ne 0 ]; then
1101 test_done $testroot $ret
1105 (cd $testroot/wt && got patch -p3 patch) \
1108 if [ $ret -eq 0 ]; then
1109 echo "stripped more components than available!"
1110 test_done $testroot 1
1114 cat <<EOF > $testroot/stderr.expected
1115 got: can't strip 1 path-components from foo/bar/alpha: bad path
1118 cmp -s $testroot/stderr.expected $testroot/stderr
1120 if [ $ret -ne 0 ]; then
1121 diff -u $testroot/stderr.expected $testroot/stderr
1123 test_done $testroot 0
1126 test_patch_whitespace() {
1127 local testroot=`test_init patch_whitespace`
1129 got checkout $testroot/repo $testroot/wt > /dev/null
1131 if [ $ret -ne 0 ]; then
1132 test_done $testroot $ret
1138 cat <<EOF > $testroot/wt/hello.c
1144 /* the trailing whitespace is on purpose */
1145 printf("hello, world\n");$trailing
1150 (cd $testroot/wt && got add hello.c && got ci -m '+hello.c') \
1153 if [ $ret -ne 0 ]; then
1154 test_done $testroot $ret
1158 # test with a diff with various whitespace corruptions
1159 cat <<EOF > $testroot/wt/patch
1164 /* the trailing whitespace is on purpose */
1165 printf("hello, world\n");
1167 + return 5; /* always fails */
1171 (cd $testroot/wt && got patch patch) \
1172 2>$testroot/stderr >$testroot/stdout
1174 if [ $ret -ne 0 ]; then
1175 echo "failed to apply diff" >&2
1176 test_done $testroot $ret
1180 echo 'M hello.c' > $testroot/stdout.expected
1181 echo '@@ -5,5 +5,5 @@ hunk contains mangled whitespace' \
1182 >> $testroot/stdout.expected
1183 cmp -s $testroot/stdout.expected $testroot/stdout
1185 if [ $ret -ne 0 ]; then
1186 diff -u $testroot/stdout.expected $testroot/stdout
1187 test_done $testroot $ret
1191 cat <<EOF > $testroot/wt/hello.c.expected
1197 /* the trailing whitespace is on purpose */
1198 printf("hello, world\n");$trailing
1199 return 5; /* always fails */
1203 cmp -s $testroot/wt/hello.c.expected $testroot/wt/hello.c
1205 if [ $ret -ne 0 ]; then
1206 diff -u $testroot/wt/hello.c.expected $testroot/wt/hello.c
1208 test_done $testroot $ret
1211 test_patch_relative_paths() {
1212 local testroot=`test_init patch_relative_paths`
1214 got checkout $testroot/repo $testroot/wt > /dev/null
1216 if [ $ret -ne 0 ]; then
1217 test_done $testroot $ret
1221 cat <<EOF > $testroot/wt/gamma/patch
1233 (cd $testroot/wt/gamma && got patch patch) > $testroot/stdout
1235 if [ $ret -ne 0 ]; then
1236 test_done $testroot $ret
1240 echo 'M gamma/delta' > $testroot/stdout.expected
1241 echo 'A gamma/eta' >> $testroot/stdout.expected
1243 cmp -s $testroot/stdout.expected $testroot/stdout
1245 if [ $ret -ne 0 ]; then
1246 diff -u $testroot/stdout.expected $testroot/stdout
1248 test_done $testroot $ret
1251 test_patch_with_path_prefix() {
1252 local testroot=`test_init patch_with_path_prefix`
1254 got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1256 if [ $ret -ne 0 ]; then
1257 test_done $testroot $ret
1261 cat <<EOF > $testroot/wt/patch
1273 (cd $testroot/wt && got patch patch) > $testroot/stdout
1275 if [ $ret -ne 0 ]; then
1276 test_done $testroot $ret
1280 echo 'M delta' > $testroot/stdout.expected
1281 echo 'A eta' >> $testroot/stdout.expected
1283 cmp -s $testroot/stdout.expected $testroot/stdout
1285 if [ $ret -ne 0 ]; then
1286 diff -u $testroot/stdout.expected $testroot/stdout
1288 test_done $testroot $ret
1291 test_patch_relpath_with_path_prefix() {
1292 local testroot=`test_init patch_relpaths_with_path_prefix`
1294 got checkout -p gamma $testroot/repo $testroot/wt > /dev/null
1296 if [ $ret -ne 0 ]; then
1297 test_done $testroot $ret
1301 mkdir -p $testroot/wt/epsilon/zeta/
1303 cat <<EOF > $testroot/wt/patch
1310 (cd $testroot/wt/epsilon/zeta && got patch -p1 $testroot/wt/patch) \
1313 if [ $ret -ne 0 ]; then
1314 test_done $testroot $ret
1318 echo 'A epsilon/zeta/theta' >> $testroot/stdout.expected
1320 cmp -s $testroot/stdout.expected $testroot/stdout
1322 if [ $ret -ne 0 ]; then
1323 diff -u $testroot/stdout.expected $testroot/stdout
1324 test_done $testroot $ret
1328 echo 'theta' > $testroot/theta.expected
1329 cmp -s $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1331 if [ $ret -ne 0 ]; then
1332 diff -u $testroot/wt/epsilon/zeta/theta $testroot/theta.expected
1334 test_done $testroot $ret
1337 test_patch_reverse() {
1338 local testroot=`test_init patch_reverse`
1340 got checkout $testroot/repo $testroot/wt > /dev/null
1342 if [ $ret -ne 0 ]; then
1343 test_done $testroot $ret
1347 cat <<EOF > $testroot/wt/patch
1352 \ No newline at end of file
1356 (cd $testroot/wt && got patch -R patch) > $testroot/stdout
1358 if [ $ret -ne 0 ]; then
1359 test_done $testroot $ret
1363 echo "M alpha" > $testroot/stdout.expected
1364 cmp -s $testroot/stdout.expected $testroot/stdout
1366 if [ $ret -ne 0 ]; then
1367 diff -u $testroot/stdout.expected $testroot/stdout
1368 test_done $testroot $ret
1372 echo -n ALPHA > $testroot/wt/alpha.expected
1373 cmp -s $testroot/wt/alpha.expected $testroot/wt/alpha
1375 if [ $ret -ne 0 ]; then
1376 diff -u $testroot/wt/alpha.expected $testroot/wt/alpha
1378 test_done $testroot $ret
1381 test_patch_merge_simple() {
1382 local testroot=`test_init patch_merge_simple`
1384 got checkout $testroot/repo $testroot/wt > /dev/null
1386 if [ $ret -ne 0 ]; then
1387 test_done $testroot $ret
1391 seq 10 > $testroot/wt/numbers
1392 chmod +x $testroot/wt/numbers
1393 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1396 if [ $ret -ne 0 ]; then
1397 test_done $testroot $ret
1401 seq 10 | sed 's/4/four/g' > $testroot/wt/numbers
1403 (cd $testroot/wt && got diff > $testroot/old.diff \
1404 && got revert numbers) >/dev/null
1406 if [ $ret -ne 0 ]; then
1407 test_done $testroot $ret
1411 seq 10 | sed 's/6/six/g' > $testroot/wt/numbers
1412 (cd $testroot/wt && got commit -m 'edit numbers') \
1415 if [ $ret -ne 0 ]; then
1416 test_done $testroot $ret
1420 (cd $testroot/wt && got patch $testroot/old.diff) \
1423 if [ $ret -ne 0 ]; then
1424 test_done $testroot $ret
1428 echo 'G numbers' > $testroot/stdout.expected
1429 cmp -s $testroot/stdout $testroot/stdout.expected
1431 if [ $ret -ne 0 ]; then
1432 diff -u $testroot/stdout $testroot/stdout.expected
1433 test_done $testroot $ret
1437 seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1438 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1440 if [ $ret -ne 0 ]; then
1441 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1442 test_done $testroot $ret
1446 test -x $testroot/wt/numbers
1448 if [ $ret -ne 0 ]; then
1449 echo "numbers lost the executable bit" >&2
1451 test_done $testroot $ret
1454 test_patch_merge_gitdiff() {
1455 local testroot=`test_init patch_merge_gitdiff`
1457 seq 10 > $testroot/repo/numbers
1458 git -C $testroot/repo add numbers && \
1459 git_commit $testroot/repo -m "nums"
1461 if [ $ret -ne 0 ]; then
1462 test_done $testroot $ret
1466 seq 10 | sed 's/4/four/g' > $testroot/repo/numbers
1467 git -C $testroot/repo diff > $testroot/old.diff
1469 if [ $ret -ne 0 ]; then
1470 test_done $testroot $ret
1475 seq 10 > $testroot/repo/numbers
1477 seq 10 | sed 's/6/six/g' > $testroot/repo/numbers
1478 git -C $testroot/repo add numbers && \
1479 git_commit $testroot/repo -m "edit"
1481 if [ $ret -ne 0 ]; then
1482 test_done $testroot $ret
1486 # now work with got:
1487 got checkout $testroot/repo $testroot/wt > /dev/null
1489 if [ $ret -ne 0 ]; then
1490 test_done $testroot $ret
1494 (cd $testroot/wt && got patch $testroot/old.diff) > $testroot/stdout
1496 if [ $ret -ne 0 ]; then
1497 test_done $testroot $ret
1501 echo 'G numbers' > $testroot/stdout.expected
1502 cmp -s $testroot/stdout $testroot/stdout.expected
1504 if [ $ret -ne 0 ]; then
1505 diff -u $testroot/stdout $testroot/stdout.expected
1507 test_done $testroot $ret
1510 test_patch_merge_base_provided() {
1511 local testroot=`test_init patch_merge_base_provided`
1513 got checkout $testroot/repo $testroot/wt >/dev/null
1515 if [ $ret -ne 0 ]; then
1516 test_done $testroot $ret
1520 seq 10 > $testroot/wt/numbers
1521 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1524 if [ $ret -ne 0 ]; then
1525 test_done $testroot $ret
1529 local commit_id=`git_show_head $testroot/repo`
1531 seq 10 | sed s/4/four/ > $testroot/wt/numbers
1533 # get rid of the metadata
1534 (cd $testroot/wt && got diff | sed -n '/^---/,$p' > patch) \
1537 seq 10 | sed s/6/six/ > $testroot/wt/numbers
1538 (cd $testroot/wt && got commit -m 'edit numbers') >/dev/null
1540 if [ $ret -ne 0 ]; then
1541 test_done $testroot $ret
1545 (cd $testroot/wt && got patch -c $commit_id patch) >$testroot/stdout
1547 if [ $ret -ne 0 ]; then
1548 test_done $testroot $ret
1552 echo 'G numbers' > $testroot/stdout.expected
1553 cmp -s $testroot/stdout $testroot/stdout.expected
1555 if [ $ret -ne 0 ]; then
1556 diff -u $testroot/stdout $testroot/stdout.expected
1557 test_done $testroot $ret
1561 seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
1562 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1564 if [ $ret -ne 0 ]; then
1565 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1567 test_done $testroot $ret
1570 test_patch_merge_conflict() {
1571 local testroot=`test_init patch_merge_conflict`
1573 got checkout $testroot/repo $testroot/wt > /dev/null
1575 if [ $ret -ne 0 ]; then
1576 test_done $testroot $ret
1580 seq 10 > $testroot/wt/numbers
1581 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1584 if [ $ret -ne 0 ]; then
1585 test_done $testroot $ret
1589 local commit_id=`git_show_head $testroot/repo`
1591 seq 10 | sed 's/6/six/g' > $testroot/wt/numbers
1592 echo ALPHA > $testroot/wt/alpha
1594 (cd $testroot/wt && got diff > $testroot/old.diff \
1595 && got revert alpha numbers) >/dev/null
1597 if [ $ret -ne 0 ]; then
1598 test_done $testroot $ret
1602 seq 10 | sed 's/6/3+3/g' > $testroot/wt/numbers
1603 printf '%s\n' a b c > $testroot/wt/alpha
1604 (cd $testroot/wt && got commit -m 'edit alpha and numbers') \
1607 if [ $ret -ne 0 ]; then
1608 test_done $testroot $ret
1612 (cd $testroot/wt && got patch $testroot/old.diff) \
1613 > $testroot/stdout 2>/dev/null
1615 if [ $ret -eq 0 ]; then
1616 echo "got patch merged a diff that should conflict" >&2
1617 test_done $testroot 1
1621 echo 'C alpha' > $testroot/stdout.expected
1622 echo 'C numbers' >> $testroot/stdout.expected
1623 echo 'Files with merge conflicts: 2' >> $testroot/stdout.expected
1624 cmp -s $testroot/stdout $testroot/stdout.expected
1626 if [ $ret -ne 0 ]; then
1627 diff -u $testroot/stdout $testroot/stdout.expected
1628 test_done $testroot $ret
1632 # XXX: prefixing every line with a tab otherwise got thinks
1633 # the file has conflicts in it.
1634 cat <<-EOF > $testroot/wt/alpha.expected
1637 ||||||| commit $commit_id
1646 cat <<-EOF > $testroot/wt/numbers.expected
1654 ||||||| commit $commit_id
1665 cmp -s $testroot/wt/alpha $testroot/wt/alpha.expected
1667 if [ $ret -ne 0 ]; then
1668 diff -u $testroot/wt/alpha $testroot/wt/alpha.expected
1669 test_done $testroot $ret
1673 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1675 if [ $ret -ne 0 ]; then
1676 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1678 test_done $testroot $ret
1681 test_patch_merge_unknown_blob() {
1682 local testroot=`test_init patch_merge_unknown_blob`
1684 got checkout $testroot/repo $testroot/wt > /dev/null
1686 if [ $ret -ne 0 ]; then
1687 test_done $testroot $ret
1691 cat <<EOF > $testroot/wt/patch
1693 diff aaaabbbbccccddddeeeeffff0000111122223333 foo/bar
1695 blob - aaaabbbbccccddddeeeeffff0000111122223333
1697 blob + 0000111122223333444455556666777788889999
1707 (cd $testroot/wt/ && got patch patch) > $testroot/stdout
1709 if [ $ret -ne 0 ]; then
1710 test_done $testroot $ret
1714 echo 'M alpha' > $testroot/stdout.expected
1715 cmp -s $testroot/stdout.expected $testroot/stdout
1717 if [ $ret -ne 0 ]; then
1718 diff -u $testroot/stdout.expected $testroot/stdout
1719 test_done $testroot $ret
1723 # try again without a `diff' header
1725 cat <<EOF > $testroot/wt/patch
1727 blob - aaaabbbbccccddddeeeeffff0000111122223333
1729 blob + 0000111122223333444455556666777788889999
1739 (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1742 if [ $ret -ne 0 ]; then
1743 test_done $testroot $ret
1747 echo 'M alpha' > $testroot/stdout.expected
1748 cmp -s $testroot/stdout.expected $testroot/stdout
1750 if [ $ret -ne 0 ]; then
1751 diff -u $testroot/stdout.expected $testroot/stdout
1752 test_done $testroot $ret
1756 # try again with a git-style diff
1758 cat <<EOF > $testroot/wt/patch
1759 diff --git a/alpha b/alpha
1760 index 0123456789ab..abcdef012345 100644
1768 (cd $testroot/wt && got revert alpha > /dev/null && got patch patch) \
1771 if [ $ret -ne 0 ]; then
1772 test_done $testroot $ret
1776 echo 'M alpha' > $testroot/stdout.expected
1777 cmp -s $testroot/stdout.expected $testroot/stdout
1779 if [ $ret -ne 0 ]; then
1780 diff -u $testroot/stdout.expected $testroot/stdout
1782 test_done $testroot $ret
1785 test_patch_merge_reverse() {
1786 local testroot=`test_init patch_merge_simple`
1788 got checkout $testroot/repo $testroot/wt > /dev/null
1790 if [ $ret -ne 0 ]; then
1791 test_done $testroot $ret
1795 seq 10 > $testroot/wt/numbers
1796 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
1799 if [ $ret -ne 0 ]; then
1800 test_done $testroot $ret
1804 local commit_id=`git_show_head $testroot/repo`
1806 seq 10 | sed s/5/five/g > $testroot/wt/numbers
1807 (cd $testroot/wt && got diff > $testroot/wt/patch \
1808 && got commit -m 'edit numbers') > /dev/null
1810 if [ $ret -ne 0 ]; then
1811 test_done $testroot $ret
1815 seq 10 | sed -e s/5/five/g -e s/6/six/g > $testroot/wt/numbers
1816 (cd $testroot/wt && got commit -m 'edit numbers again') >/dev/null
1818 if [ $ret -ne 0 ]; then
1819 test_done $testroot $ret
1823 (cd $testroot/wt && got patch -R patch) >/dev/null 2>&1
1825 if [ $ret -eq 0 ]; then
1826 echo "unexpectedly reverted the patch" >&2
1827 test_done $testroot 1
1831 cat <<-EOF > $testroot/wt/numbers.expected
1844 >>>>>>> commit $commit_id
1851 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
1853 if [ $ret -ne 0 ]; then
1854 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
1856 test_done $testroot $ret
1859 test_patch_newfile_xbit_got_diff() {
1860 local testroot=`test_init patch_newfile_xbit`
1862 got checkout $testroot/repo $testroot/wt > /dev/null
1864 if [ $ret -ne 0 ]; then
1865 test_done $testroot $ret
1869 cat <<EOF > $testroot/wt/patch
1871 blob + abcdef0123456789abcdef012345678901234567 (mode 755)
1878 (cd $testroot/wt && got patch patch) > /dev/null
1880 if [ $ret -ne 0 ]; then
1881 test_done $testroot $ret
1885 if [ ! -x $testroot/wt/xfile ]; then
1886 echo "failed to set xbit on newfile" >&2
1887 test_done $testroot 1
1891 echo xfile > $testroot/wt/xfile.expected
1892 cmp -s $testroot/wt/xfile $testroot/wt/xfile.expected
1894 if [ $ret -ne 0 ]; then
1896 diff -u $testroot/wt/xfile $testroot/wt/xfile.expected
1899 test_done $testroot $ret
1902 test_patch_newfile_xbit_git_diff() {
1903 local testroot=`test_init patch_newfile_xbit`
1905 got checkout $testroot/repo $testroot/wt > /dev/null
1907 if [ $ret -ne 0 ]; then
1908 test_done $testroot $ret
1912 cat <<EOF > $testroot/wt/patch
1913 diff --git a/xfile b/xfile
1914 new file mode 100755
1915 index 00000000..abcdef01
1922 (cd $testroot/wt && got patch patch) > /dev/null
1924 if [ $ret -ne 0 ]; then
1925 test_done $testroot $ret
1929 if [ ! -x $testroot/wt/xfile ]; then
1930 echo "failed to set xbit on newfile" >&2
1931 test_done $testroot 1
1935 echo xfile > $testroot/wt/xfile.expected
1936 cmp -s $testroot/wt/xfile $testroot/wt/xfile.expected
1938 if [ $ret -ne 0 ]; then
1940 diff -u $testroot/wt/xfile $testroot/wt/xfile.expected
1943 test_done $testroot $ret
1946 test_patch_umask() {
1947 local testroot=`test_init patch_umask`
1949 got checkout "$testroot/repo" "$testroot/wt" >/dev/null
1951 cat <<EOF >$testroot/wt/patch
1959 # using a subshell to avoid clobbering global umask
1960 (umask 077 && cd "$testroot/wt" && got patch <patch) >/dev/null
1962 if [ $ret -ne 0 ]; then
1963 test_done "$testroot" $ret
1967 if ! ls -l "$testroot/wt/alpha" | grep -q ^-rw-------; then
1968 echo "alpha is not 0600 after patch" >&2
1969 ls -l "$testroot/wt/alpha" >&2
1970 test_done "$testroot" 1
1974 test_done "$testroot" 0
1977 test_patch_remove_binary_file() {
1978 local testroot=`test_init patch_remove_binary_file`
1980 if ! got checkout $testroot/repo $testroot/wt >/dev/null; then
1981 test_done $testroot $ret
1985 dd if=/dev/zero of=$testroot/wt/x bs=1 count=16 2>/dev/null >&2
1986 (cd $testroot/wt && got add x && got commit -m +x) >/dev/null
1988 (cd $testroot/wt && \
1989 got branch demo && \
1992 got up -b master) >/dev/null
1994 echo 'D x' > $testroot/stdout.expected
1996 (cd $testroot/wt && got log -c demo -l 1 -p >patch)
1998 (cd $testroot/wt && got patch <patch) > $testroot/stdout
1999 if [ $? -ne 0 ]; then
2000 echo 'patch failed' >&2
2001 test_done $testroot 1
2005 if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2006 diff -u $testroot/stdout.expected $testroot/stdout
2007 test_done $testroot 1
2011 # try again using a git produced diff
2012 (cd $testroot/wt && got revert x) >/dev/null
2014 git -C $testroot/repo show demo >$testroot/wt/patch
2016 (cd $testroot/wt && got patch <patch) > $testroot/stdout
2017 if [ $? -ne 0 ]; then
2018 echo 'patch failed' >&2
2019 test_done $testroot 1
2023 if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2024 diff -u $testroot/stdout.expected $testroot/stdout
2025 test_done $testroot 1
2029 # try again using a diff(1) style patch
2030 (cd $testroot/wt && got revert x) >/dev/null
2032 echo "Binary files x and /dev/null differ" >$testroot/wt/patch
2033 (cd $testroot/wt && got patch <patch) >$testroot/stdout
2034 if [ $? -ne 0 ]; then
2035 echo 'patch failed' >&2
2036 test_done $testroot 1
2040 if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
2041 diff -u $testroot/stdout.expected $testroot/stdout
2042 test_done $testroot 1
2046 test_done $testroot 0
2049 test_patch_commit_keywords() {
2050 local testroot=`test_init patch_commit_keywords`
2052 got checkout $testroot/repo $testroot/wt >/dev/null
2054 if [ $ret -ne 0 ]; then
2055 test_done $testroot $ret
2059 seq 10 > $testroot/wt/numbers
2060 (cd $testroot/wt && got add numbers && got commit -m +numbers) \
2063 if [ $ret -ne 0 ]; then
2064 test_done $testroot $ret
2068 seq 10 | sed s/4/four/ > $testroot/wt/numbers
2070 # get rid of the metadata
2071 (cd $testroot/wt && got diff | sed -n '/^---/,$p' > patch) \
2074 seq 10 | sed s/6/six/ > $testroot/wt/numbers
2075 (cd $testroot/wt && got commit -m 'edit numbers') >/dev/null
2077 if [ $ret -ne 0 ]; then
2078 test_done $testroot $ret
2082 (cd $testroot/wt && got patch -c :head:- patch) >$testroot/stdout
2084 if [ $ret -ne 0 ]; then
2085 test_done $testroot $ret
2089 echo 'G numbers' > $testroot/stdout.expected
2090 cmp -s $testroot/stdout $testroot/stdout.expected
2092 if [ $ret -ne 0 ]; then
2093 diff -u $testroot/stdout $testroot/stdout.expected
2094 test_done $testroot $ret
2098 seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
2099 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
2101 if [ $ret -ne 0 ]; then
2102 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
2105 (cd "$testroot/wt" && got rv numbers > /dev/null)
2107 (cd $testroot/wt && got patch -c :base:- patch) >$testroot/stdout
2109 if [ $ret -ne 0 ]; then
2110 test_done $testroot $ret
2114 echo 'G numbers' > $testroot/stdout.expected
2115 cmp -s $testroot/stdout $testroot/stdout.expected
2117 if [ $ret -ne 0 ]; then
2118 diff -u $testroot/stdout $testroot/stdout.expected
2119 test_done $testroot $ret
2123 seq 10 | sed -e s/4/four/ -e s/6/six/ > $testroot/wt/numbers.expected
2124 cmp -s $testroot/wt/numbers $testroot/wt/numbers.expected
2126 if [ $ret -ne 0 ]; then
2127 diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
2130 test_done $testroot $ret
2134 run_test test_patch_basic
2135 run_test test_patch_dont_apply
2136 run_test test_patch_malformed
2137 run_test test_patch_no_patch
2138 run_test test_patch_equals_for_context
2139 run_test test_patch_rename
2140 run_test test_patch_illegal_status
2141 run_test test_patch_nop
2142 run_test test_patch_preserve_perm
2143 run_test test_patch_create_dirs
2144 run_test test_patch_with_offset
2145 run_test test_patch_empty_file
2146 run_test test_patch_prefer_new_path
2147 run_test test_patch_no_newline
2148 run_test test_patch_strip
2149 run_test test_patch_whitespace
2150 run_test test_patch_relative_paths
2151 run_test test_patch_with_path_prefix
2152 run_test test_patch_relpath_with_path_prefix
2153 run_test test_patch_reverse
2154 run_test test_patch_merge_simple
2155 run_test test_patch_merge_gitdiff
2156 run_test test_patch_merge_base_provided
2157 run_test test_patch_merge_conflict
2158 run_test test_patch_merge_unknown_blob
2159 run_test test_patch_merge_reverse
2160 run_test test_patch_newfile_xbit_got_diff
2161 run_test test_patch_newfile_xbit_git_diff
2162 run_test test_patch_umask
2163 run_test test_patch_remove_binary_file
2164 run_test test_patch_commit_keywords