3 test_description
='use of -i/-w options with tg commands that support them
5 These are the -i and -w options that cause the index or working tree to be
6 used, respectively, not any other meanings they might have.
8 Specifically files, mail, next, patch, prev and summary commands.
19 eval "$_cmd "'"$@" >_tmp' || _ec
=$?
24 from
="$(git var GIT_AUTHOR_IDENT)" && test -n "$from" || die
27 REAL_GIT
="$( { "unset" -f git; } >/dev/null 2>&1 || :; command -v "${GIT_PATH:-git}" )" || die
29 test_expect_success
'setup' '
30 git config core.abbrev 16 &&
32 printf "%s\n" _tmp actual expected >.git/info/exclude &&
33 tg_test_create_branches <<-EOT &&
71 git checkout -f t/secondary &&
76 git commit -m "f3-5" &&
77 tg_test_create_branches <<-EOT &&
85 echo t/branch2 >expected &&
86 test_cmp .topdeps expected &&
87 echo "From: $from" >expected &&
88 echo "Subject: [PATCH] branch t/secondary" >>expected &&
89 test_cmp .topmsg expected &&
90 mkdir -p .git/dummy && test -d .git/dummy &&
91 write_script .git/dummy/git <<-EOT &&
92 test "\$1" = "send-email" && test \$# -ge 2 &&
93 eval exec cat "\\"\\\$\$#\\"" ||
94 exec "${REAL_GIT:-false}" "\$@"
96 PATH="$PWD/.git/dummy:$PATH" \
97 command git send-email foo bar you hoo .topmsg >actual &&
98 test_cmp actual expected
101 case "$test_hash_algo" in
103 primarybase
=8e476c63c7ef4558
104 secondarybase
=8f7ce5c9f088954c
107 primarybase
=597e7c92a7237dd5
108 secondarybase
=1ed0c61ee3ddc0dc
112 test_expect_success LASTOK
'verify setup' '
113 cat <<-EOT >expected &&
133 trim tg summary --rdeps --heads >actual &&
134 test_cmp actual expected &&
135 cat <<-EOT >expected &&
136 0 t/branch1 [PATCH] branch t/branch1
137 0 t/branch2 [PATCH] branch t/branch2
138 0 t/branch3 [PATCH] branch t/branch3
139 0 t/branch4 [PATCH] branch t/branch4
140 0 t/branch5 [PATCH] branch t/branch5
141 0 t/primary [PATCH] branch t/primary
142 0 t/primary2 [PATCH] branch t/primary2
143 > t/secondary [PATCH] branch t/secondary
144 0 t/secondary2 [PATCH] branch t/secondary2
146 trim tg summary >actual &&
147 test_cmp actual expected &&
148 cat <<-EOT >expected &&
149 Topic Branch: t/primary (1/1 commit)
150 Subject: [PATCH] branch t/primary
151 Dependents: t/primary2
156 trim tg info -v t/primary >actual &&
157 test_cmp actual expected &&
158 cat <<-EOT >expected &&
159 Topic Branch: t/secondary (2/2 commits)
160 Subject: [PATCH] branch t/secondary
161 Dependents: t/secondary2
166 trim tg info -v t/secondary >actual &&
167 test_cmp actual expected
170 test_expect_success LASTOK
'setup index and working tree' '
171 echo "From: $from" >.topmsg &&
172 echo "Subject: [PATCH] branch t/tertiary" >>.topmsg &&
173 echo t/branch3 >.topdeps &&
176 git add .topdeps .topmsg f3 &&
177 echo "From: $from" >.topmsg &&
178 echo "Subject: [PATCH] branch t/quaternary" >>.topmsg &&
179 echo t/branch4 >.topdeps &&
180 echo t/branch5 >>.topdeps &&
184 test_when_finished test_set_prereq SETUP
187 test_expect_success SETUP
'files' '
188 cat <<-EOT >expected &&
194 test_cmp actual expected
197 test_expect_success SETUP
'files -i' '
198 cat <<-EOT >expected &&
201 tg files -i >actual &&
202 test_cmp actual expected
205 test_expect_success SETUP
'files -w' '
206 cat <<-EOT >expected &&
210 tg files -w >actual &&
211 test_cmp actual expected
214 # tg mail uses tg patch so test tg patch and follow up with tg mail
216 case "$test_hash_algo" in
218 f1f2f3blob
=e69de29bb2d1d643
221 f1f2f3blob
=473a0f4c3be8a936
225 test_expect_success SETUP
'patch' '
226 cat <<-EOT >expected &&
227 From: Te s t (Author) <test@example.net>
228 Subject: [PATCH] branch t/secondary
234 3 files changed, 0 insertions(+), 0 deletions(-)
235 create mode 100644 f3
236 create mode 100644 f4
237 create mode 100644 f5
241 index 0000000000000000..$f1f2f3blob
244 index 0000000000000000..$f1f2f3blob
247 index 0000000000000000..$f1f2f3blob
250 tg: ($secondarybase..) t/secondary (depends on: t/branch2)
253 test_cmp actual expected
256 test_expect_success SETUP
,LASTOK
'mail' '
257 PATH="$PWD/.git/dummy:$PATH" && export PATH &&
259 test_cmp actual expected
262 case "$test_hash_algo" in
264 f3blob
=7c8ac2f8d82a1eb5
267 f3blob
=7b6de9267ded53f0
271 test_expect_success SETUP
'patch -i' '
272 cat <<-EOT >expected &&
273 From: Te s t (Author) <test@example.net>
274 Subject: [PATCH] branch t/tertiary
278 1 file changed, 1 insertion(+)
279 create mode 100644 f3
283 index 0000000000000000..$f3blob
290 tg: ($secondarybase..) t/secondary (depends on: t/branch3)
292 tg patch -i >actual &&
293 test_cmp actual expected
296 test_expect_success SETUP
,LASTOK
'mail -i' '
297 PATH="$PWD/.git/dummy:$PATH" && export PATH &&
298 tg mail -i >actual &&
299 test_cmp actual expected
301 case "$test_hash_algo" in
303 f4blob
=bfd6a6583f9a9ac5
304 f5blob
=4806cb9df135782b
307 f4blob
=a76920b2c5d13460
308 f5blob
=343656d54d3d9c28
312 test_expect_success SETUP
'patch -w' '
313 cat <<-EOT >expected &&
314 From: Te s t (Author) <test@example.net>
315 Subject: [PATCH] branch t/quaternary
320 2 files changed, 2 insertions(+)
321 create mode 100644 f4
322 create mode 100644 f5
326 index 0000000000000000..$f4blob
333 index 0000000000000000..$f5blob
340 tg: ($secondarybase..) t/secondary (depends on: t/branch4 t/branch5)
342 tg patch -w >actual &&
343 test_cmp actual expected
346 test_expect_success SETUP
,LASTOK
'mail -w' '
347 PATH="$PWD/.git/dummy:$PATH" && export PATH &&
348 tg mail -w >actual &&
349 test_cmp actual expected
352 test_expect_success SETUP
'prev' '
353 echo t/branch2 >expected &&
355 test_cmp actual expected
358 test_expect_success SETUP
'prev -i' '
359 echo t/branch3 >expected &&
360 tg prev -i >actual &&
361 test_cmp actual expected
364 test_expect_success SETUP
'prev -w' '
365 echo t/branch5 >expected &&
366 tg prev -w >actual &&
367 test_cmp actual expected &&
368 echo t/branch4 >expected &&
369 tg prev -w -n 2 >actual &&
370 test_cmp actual expected
373 test_expect_success SETUP
'next' '
374 echo t/secondary2 >expected &&
376 test_cmp actual expected
379 test_expect_success SETUP
'next -i' '
380 echo t/secondary >expected &&
381 tg next -i t/branch3 >actual &&
382 test_cmp actual expected &&
384 tg next -i t/branch2 >actual &&
385 test_cmp actual expected &&
386 tg next -i t/branch4 >actual &&
387 test_cmp actual expected &&
388 tg next -i t/branch5 >actual &&
389 test_cmp actual expected
392 test_expect_success SETUP
'next -w' '
393 echo t/branch5 >expected &&
394 tg next -w t/branch4 >actual &&
395 test_cmp actual expected &&
396 echo t/secondary >expected &&
397 tg next -w t/branch5 >actual &&
398 test_cmp actual expected &&
400 tg next -w t/branch2 >actual &&
401 test_cmp actual expected &&
402 tg next -w t/branch3 >actual &&
403 test_cmp actual expected
406 test_expect_success SETUP
'summary --deps-only' '
407 cat <<-\EOT >expected &&
412 tg summary --deps-only >actual &&
413 test_cmp actual expected
416 test_expect_success SETUP
'summary --deps-only -i' '
417 cat <<-\EOT >expected &&
422 tg summary --deps-only -i >actual &&
423 test_cmp actual expected
426 test_expect_success SETUP
'summary --deps-only -w' '
427 cat <<-\EOT >expected &&
434 tg summary --deps-only -w >actual &&
435 test_cmp actual expected
438 test_expect_success SETUP
'summary --deps' '
439 cat <<-\EOT >expected &&
447 t/secondary t/branch2
448 t/secondary2 t/secondary
450 tg summary --deps >actual &&
451 test_cmp actual expected
454 test_expect_success SETUP
'summary --deps -i' '
455 cat <<-\EOT >expected &&
463 t/secondary t/branch3
464 t/secondary2 t/secondary
466 tg summary --deps -i >actual &&
467 test_cmp actual expected
470 test_expect_success SETUP
'summary --deps -w' '
471 cat <<-\EOT >expected &&
479 t/secondary t/branch4
480 t/secondary t/branch5
481 t/secondary2 t/secondary
483 tg summary --deps -w >actual &&
484 test_cmp actual expected
487 test_expect_success SETUP
'summary --rdeps --heads' '
488 cat <<\EOT >expected &&
508 tg summary --rdeps --heads >actual &&
509 test_cmp actual expected
512 test_expect_success SETUP
'summary --rdeps --heads -i' '
513 cat <<\EOT >expected &&
533 tg summary --rdeps --heads -i >actual &&
534 test_cmp actual expected
537 test_expect_success SETUP
'summary --rdeps --heads -w' '
538 cat <<\EOT >expected &&
557 tg summary --rdeps --heads -w >actual &&
558 test_cmp actual expected
561 test_expect_success SETUP
'summary -vl' '
562 cat <<\EOT >expected &&
563 t/branch1 [PATCH] branch t/branch1
564 t/branch2 [PATCH] branch t/branch2
565 t/branch3 [PATCH] branch t/branch3
566 t/branch4 [PATCH] branch t/branch4
567 t/branch5 [PATCH] branch t/branch5
568 t/primary [PATCH] branch t/primary
569 t/primary2 [PATCH] branch t/primary2
570 t/secondary [PATCH] branch t/secondary
571 t/secondary2 [PATCH] branch t/secondary2
573 trim tg summary -vl >actual &&
574 test_cmp actual expected &&
575 trim tg summary -vvl >actual &&
576 test_cmp actual expected
579 test_expect_success SETUP
'summary -vl -i' '
580 cat <<\EOT >expected &&
581 t/branch1 [PATCH] branch t/branch1
582 t/branch2 [PATCH] branch t/branch2
583 t/branch3 [PATCH] branch t/branch3
584 t/branch4 [PATCH] branch t/branch4
585 t/branch5 [PATCH] branch t/branch5
586 t/primary [PATCH] branch t/primary
587 t/primary2 [PATCH] branch t/primary2
588 t/secondary [PATCH] branch t/tertiary
589 t/secondary2 [PATCH] branch t/secondary2
591 trim tg summary -vl -i >actual &&
592 test_cmp actual expected &&
593 trim tg summary -vvl -i >actual &&
594 test_cmp actual expected
597 test_expect_success SETUP
'summary -vl -w' '
598 cat <<\EOT >expected &&
599 t/branch1 [PATCH] branch t/branch1
600 t/branch2 [PATCH] branch t/branch2
601 t/branch3 [PATCH] branch t/branch3
602 t/branch4 [PATCH] branch t/branch4
603 t/branch5 [PATCH] branch t/branch5
604 t/primary [PATCH] branch t/primary
605 t/primary2 [PATCH] branch t/primary2
606 t/secondary [PATCH] branch t/quaternary
607 t/secondary2 [PATCH] branch t/secondary2
609 trim tg summary -vl -w >actual &&
610 test_cmp actual expected &&
611 trim tg summary -vvl -w >actual &&
612 test_cmp actual expected
615 test_expect_success SETUP
'summary @' '
616 cat <<\EOT >expected &&
617 0 t/branch2 [PATCH] branch t/branch2
618 > t/secondary [PATCH] branch t/secondary
619 0 t/secondary2 [PATCH] branch t/secondary2
621 trim tg summary @ >actual &&
622 test_cmp actual expected
625 test_expect_success SETUP
'summary -i @' '
626 cat <<\EOT >expected &&
627 0 * t/branch3 [PATCH] branch t/branch3
628 > D t/secondary [PATCH] branch t/tertiary
629 0 D t/secondary2 [PATCH] branch t/secondary2
631 trim tg summary -i @ >actual &&
632 test_cmp actual expected
635 test_expect_success SETUP
'summary -w @' '
636 cat <<\EOT >expected &&
637 0 * t/branch4 [PATCH] branch t/branch4
638 0 * t/branch5 [PATCH] branch t/branch5
639 > D t/secondary [PATCH] branch t/quaternary
640 0 D t/secondary2 [PATCH] branch t/secondary2
642 trim tg summary -w @ >actual &&
643 test_cmp actual expected
646 test_expect_success SETUP
'summary' '
647 cat <<\EOT >expected &&
648 0 t/branch1 [PATCH] branch t/branch1
649 0 t/branch2 [PATCH] branch t/branch2
650 0 t/branch3 [PATCH] branch t/branch3
651 0 t/branch4 [PATCH] branch t/branch4
652 0 t/branch5 [PATCH] branch t/branch5
653 0 t/primary [PATCH] branch t/primary
654 0 t/primary2 [PATCH] branch t/primary2
655 > t/secondary [PATCH] branch t/secondary
656 0 t/secondary2 [PATCH] branch t/secondary2
658 trim tg summary >actual &&
659 test_cmp actual expected
662 test_expect_success SETUP
'summary -i' '
663 cat <<\EOT >expected &&
664 0 t/branch1 [PATCH] branch t/branch1
665 0 t/branch2 [PATCH] branch t/branch2
666 0 * t/branch3 [PATCH] branch t/branch3
667 0 t/branch4 [PATCH] branch t/branch4
668 0 t/branch5 [PATCH] branch t/branch5
669 0 t/primary [PATCH] branch t/primary
670 0 t/primary2 [PATCH] branch t/primary2
671 > D t/secondary [PATCH] branch t/tertiary
672 0 D t/secondary2 [PATCH] branch t/secondary2
674 trim tg summary -i >actual &&
675 test_cmp actual expected
678 test_expect_success SETUP
'summary -w' '
679 cat <<\EOT >expected &&
680 0 t/branch1 [PATCH] branch t/branch1
681 0 t/branch2 [PATCH] branch t/branch2
682 0 t/branch3 [PATCH] branch t/branch3
683 0 * t/branch4 [PATCH] branch t/branch4
684 0 * t/branch5 [PATCH] branch t/branch5
685 0 t/primary [PATCH] branch t/primary
686 0 t/primary2 [PATCH] branch t/primary2
687 > D t/secondary [PATCH] branch t/quaternary
688 0 D t/secondary2 [PATCH] branch t/secondary2
690 trim tg summary -w >actual &&
691 test_cmp actual expected
694 test_expect_success SETUP
'info' '
695 cat <<EOT >expected &&
696 Topic Branch: t/secondary (2/2 commits)
697 Subject: [PATCH] branch t/secondary
702 trim tg info >actual &&
703 test_cmp actual expected
706 test_expect_success SETUP
'info -i' '
707 cat <<EOT >expected &&
708 Topic Branch: t/secondary (2/2 commits)
709 Subject: [PATCH] branch t/tertiary
713 t/branch3 (2/2 commits)
715 trim tg info -i >actual &&
716 test_cmp actual expected
719 test_expect_success SETUP
'info -w' '
720 cat <<EOT >expected &&
721 Topic Branch: t/secondary (2/2 commits)
722 Subject: [PATCH] branch t/quaternary
727 t/branch4 (2/2 commits)
728 t/branch5 (2/2 commits)
730 trim tg info -w >actual &&
731 test_cmp actual expected
734 test_expect_success SETUP
'info -v' '
735 cat <<EOT >expected &&
736 Topic Branch: t/secondary (2/2 commits)
737 Subject: [PATCH] branch t/secondary
738 Dependents: t/secondary2
743 trim tg info -v >actual &&
744 test_cmp actual expected
747 case "$test_hash_algo" in
749 quaternarybase
=8f7ce5c9f088954c
750 branch2base
=64ef3d8ae1560635
751 branch3base
=231a8797a3d0de74
752 branch4base
=f6890848ee0253af
753 branch5base
=261e548eac1f8d28
756 quaternarybase
=1ed0c61ee3ddc0dc
757 branch2base
=341670e4d25e58c8
758 branch3base
=80b378eef7859f1e
759 branch4base
=6d0162e00d6052c2
760 branch5base
=864390011614c02a
764 test_expect_success SETUP
'info -v -i' '
765 cat <<EOT >expected &&
766 Topic Branch: t/secondary (2/2 commits)
767 Subject: [PATCH] branch t/tertiary
768 Dependents: t/secondary2
772 t/branch3 (2/2 commits)
774 trim tg info -v -i >actual &&
775 test_cmp actual expected &&
776 cat <<EOT >expected &&
777 Topic Branch: t/branch3 (1/1 commit)
778 Subject: [PATCH] branch t/branch3
779 Dependents: t/secondary
784 trim tg info -v -i t/branch3 >actual &&
785 test_cmp actual expected &&
786 cat <<EOT >expected &&
787 Topic Branch: t/branch2 (1/1 commit)
788 Subject: [PATCH] branch t/branch2
794 trim tg info -v -i t/branch2 >actual &&
795 test_cmp actual expected
798 test_expect_success SETUP
'info -v -w' '
799 cat <<EOT >expected &&
800 Topic Branch: t/secondary (2/2 commits)
801 Subject: [PATCH] branch t/quaternary
802 Dependents: t/secondary2
803 Base: $quaternarybase
807 t/branch4 (2/2 commits)
808 t/branch5 (2/2 commits)
810 trim tg info -v -w >actual &&
811 test_cmp actual expected &&
812 cat <<EOT >expected &&
813 Topic Branch: t/branch4 (1/1 commit)
814 Subject: [PATCH] branch t/branch4
815 Dependents: t/secondary
820 trim tg info -v -w t/branch4 >actual &&
821 test_cmp actual expected &&
822 cat <<EOT >expected &&
823 Topic Branch: t/branch5 (1/1 commit)
824 Subject: [PATCH] branch t/branch5
825 Dependents: t/secondary
830 trim tg info -v -w t/branch5 >actual &&
831 test_cmp actual expected &&
832 cat <<EOT >expected &&
833 Topic Branch: t/branch2 (1/1 commit)
834 Subject: [PATCH] branch t/branch2
840 trim tg info -v -w t/branch2 >actual &&
841 test_cmp actual expected
844 test_expect_success SETUP
'info -v -v' '
845 cat <<EOT >expected &&
846 Topic Branch: t/secondary (2/2 commits)
847 Subject: [PATCH] branch t/secondary
848 Dependents: t/secondary2
853 trim tg info -v -v >actual &&
854 test_cmp actual expected
857 test_expect_success SETUP
'info -v -v -i' '
858 cat <<EOT >expected &&
859 Topic Branch: t/secondary (2/2 commits)
860 Subject: [PATCH] branch t/tertiary
861 Dependents: t/secondary2
865 t/branch3 (2/2 commits)
867 trim tg info -v -v -i >actual &&
868 test_cmp actual expected &&
869 cat <<EOT >expected &&
870 Topic Branch: t/branch3 (1/1 commit)
871 Subject: [PATCH] branch t/branch3
872 Dependents: t/secondary [needs merge]
877 trim tg info -v -v -i t/branch3 >actual &&
878 test_cmp actual expected &&
879 cat <<EOT >expected &&
880 Topic Branch: t/branch2 (1/1 commit)
881 Subject: [PATCH] branch t/branch2
887 trim tg info -v -v -i t/branch2 >actual &&
888 test_cmp actual expected
891 test_expect_success SETUP
'info -v -v -w' '
892 cat <<EOT >expected &&
893 Topic Branch: t/secondary (2/2 commits)
894 Subject: [PATCH] branch t/quaternary
895 Dependents: t/secondary2
900 t/branch4 (2/2 commits)
901 t/branch5 (2/2 commits)
903 trim tg info -v -v -w >actual &&
904 test_cmp actual expected &&
905 cat <<EOT >expected &&
906 Topic Branch: t/branch4 (1/1 commit)
907 Subject: [PATCH] branch t/branch4
908 Dependents: t/secondary [needs merge]
913 trim tg info -v -v -w t/branch4 >actual &&
914 test_cmp actual expected &&
915 cat <<EOT >expected &&
916 Topic Branch: t/branch5 (1/1 commit)
917 Subject: [PATCH] branch t/branch5
918 Dependents: t/secondary [needs merge]
923 trim tg info -v -v -w t/branch5 >actual &&
924 test_cmp actual expected &&
925 cat <<EOT >expected &&
926 Topic Branch: t/branch2 (1/1 commit)
927 Subject: [PATCH] branch t/branch2
933 trim tg info -v -v -w t/branch2 >actual &&
934 test_cmp actual expected
937 test_expect_success SETUP
'info --dependencies' '
938 cat <<-\EOT >expected &&
941 tg info --dependencies >actual &&
942 test_cmp actual expected
945 test_expect_success SETUP
'info --dependencies -i' '
946 cat <<-\EOT >expected &&
949 tg info --dependencies -i >actual &&
950 test_cmp actual expected
953 test_expect_success SETUP
'info --dependencies -w' '
954 cat <<-\EOT >expected &&
958 tg info --dependencies -w >actual &&
959 test_cmp actual expected
962 test_expect_success SETUP
'info --dependents' '
963 cat <<-\EOT >expected &&
966 tg info --dependents >actual &&
967 test_cmp actual expected &&
968 cat <<-\EOT >expected &&
971 tg info --dependents t/branch2 >actual &&
972 test_cmp actual expected
975 test_expect_success SETUP
'info --dependents -i' '
976 cat <<-\EOT >expected &&
979 tg info --dependents -i >actual &&
980 test_cmp actual expected &&
981 cat <<-\EOT >expected &&
984 tg info --dependents -i t/branch3 >actual &&
985 test_cmp actual expected &&
987 tg info --dependents -i t/branch2 >actual &&
988 test_cmp actual expected &&
989 tg info --dependents -i t/branch4 >actual &&
990 test_cmp actual expected &&
991 tg info --dependents -i t/branch5 >actual &&
992 test_cmp actual expected
995 test_expect_success SETUP
'info --dependents -w' '
996 cat <<-\EOT >expected &&
999 tg info --dependents -w >actual &&
1000 test_cmp actual expected &&
1001 cat <<-\EOT >expected &&
1004 tg info --dependents -w t/branch4 >actual &&
1005 test_cmp actual expected &&
1006 tg info --dependents -w t/branch5 >actual &&
1007 test_cmp actual expected &&
1009 tg info --dependents -w t/branch2 >actual &&
1010 test_cmp actual expected &&
1011 tg info --dependents -w t/branch3 >actual &&
1012 test_cmp actual expected
1015 test_expect_success SETUP
'info --series' '
1016 cat <<\EOT >expected &&
1017 t/branch2 [PATCH] branch t/branch2
1018 * t/secondary [PATCH] branch t/secondary
1019 t/secondary2 [PATCH] branch t/secondary2
1021 trim tg info --series >actual &&
1022 test_cmp actual expected
1025 test_expect_success SETUP
'info --series -i' '
1026 cat <<\EOT >expected &&
1027 t/branch3 [PATCH] branch t/branch3
1028 * t/secondary [PATCH] branch t/tertiary
1029 t/secondary2 [PATCH] branch t/secondary2
1031 trim tg info --series -i >actual &&
1032 test_cmp actual expected
1035 test_expect_success SETUP
'info --series -w' '
1036 cat <<\EOT >expected &&
1037 t/branch4 [PATCH] branch t/branch4
1038 t/branch5 [PATCH] branch t/branch5
1039 * t/secondary [PATCH] branch t/quaternary
1040 t/secondary2 [PATCH] branch t/secondary2
1042 trim tg info --series -w >actual &&
1043 test_cmp actual expected
1046 test_expect_success SETUP
'info --leaves' '
1047 cat <<-\EOT >expected &&
1050 tg info --leaves >actual &&
1051 test_cmp actual expected
1054 test_expect_success SETUP
'info --leaves -i' '
1055 cat <<-\EOT >expected &&
1058 tg info --leaves -i >actual &&
1059 test_cmp actual expected
1062 test_expect_success SETUP
'info --leaves -w' '
1063 cat <<-\EOT >expected &&
1067 tg info --leaves -w >actual &&
1068 test_cmp actual expected
1071 test_expect_success SETUP
'info --heads' '
1072 cat <<-\EOT >expected &&
1075 tg info --heads >actual &&
1076 test_cmp actual expected
1079 test_expect_success SETUP
'info --heads -i' '
1080 cat <<-\EOT >expected &&
1083 tg info --heads -i >actual &&
1084 test_cmp actual expected &&
1085 tg info --heads -i t/branch3 >actual &&
1086 test_cmp actual expected &&
1087 cat <<-\EOT >expected &&
1090 tg info --heads -i t/branch2 >actual &&
1091 cat <<-\EOT >expected &&
1094 tg info --heads -i t/branch4 >actual &&
1095 test_cmp actual expected &&
1096 cat <<-\EOT >expected &&
1099 tg info --heads -i t/branch5 >actual &&
1100 test_cmp actual expected
1103 test_expect_success SETUP
'info --heads -w' '
1104 cat <<-\EOT >expected &&
1107 tg info --heads -w >actual &&
1108 test_cmp actual expected &&
1109 tg info --heads -w t/branch4 >actual &&
1110 test_cmp actual expected &&
1111 tg info --heads -w t/branch5 >actual &&
1112 test_cmp actual expected &&
1113 cat <<-\EOT >expected &&
1116 tg info --heads -w t/branch2 >actual &&
1117 test_cmp actual expected &&
1118 cat <<-\EOT >expected &&
1121 tg info --heads -w t/branch3 >actual &&
1122 test_cmp actual expected
1125 test_expect_success SETUP
'setup detached HEAD' '
1126 git update-ref --no-deref HEAD HEAD^0 HEAD^0 &&
1127 test_must_fail git symbolic-ref HEAD >/dev/null 2>&1 &&
1128 test_when_finished test_set_prereq SETUP2
1131 test_expect_success SETUP2
'detached info --heads' '
1132 cat <<-\EOT >expected &&
1135 tg info --heads >actual &&
1136 test_cmp actual expected
1139 test_expect_success SETUP2
'detached info --heads -i' '
1140 cat <<-\EOT >expected &&
1143 tg info --heads -i >actual &&
1144 test_cmp actual expected &&
1145 tg info --heads -i t/branch2 >actual &&
1146 test_cmp actual expected &&
1147 cat <<-\EOT >expected &&
1150 tg info --heads -i t/branch3 >actual &&
1151 test_cmp actual expected &&
1152 cat <<-\EOT >expected &&
1155 tg info --heads -i t/branch4 >actual &&
1156 test_cmp actual expected &&
1157 cat <<-\EOT >expected &&
1160 tg info --heads -i t/branch5 >actual &&
1161 test_cmp actual expected
1164 test_expect_success SETUP2
'detached info --heads -w' '
1165 cat <<-\EOT >expected &&
1168 tg info --heads -w >actual &&
1169 test_cmp actual expected &&
1170 tg info --heads -w t/branch2 >actual &&
1171 test_cmp actual expected &&
1172 cat <<-\EOT >expected &&
1175 tg info --heads -w t/branch3 >actual &&
1176 test_cmp actual expected &&
1177 cat <<-\EOT >expected &&
1180 tg info --heads -w t/branch4 >actual &&
1181 test_cmp actual expected &&
1182 cat <<-\EOT >expected &&
1185 tg info --heads -w t/branch5 >actual &&
1186 test_cmp actual expected