tg.sh: handle help -h
[topgit/pro.git] / t / t4400-options-iw.sh
blob2776d9bd5c26f00c3cd780767c06b5d158e6e0ac
1 #!/bin/sh
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.
11 . ./test-lib.sh
13 test_plan 64
15 trim() {
16 _cmd="$1"
17 shift
18 _ec=0
19 eval "$_cmd "'"$@" >_tmp' || _ec=$?
20 tr -s '\t ' ' ' <_tmp
21 return $_ec
24 from="$(git var GIT_AUTHOR_IDENT)" && test -n "$from" || die
25 from="${from%>*}>"
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 &&
31 mkdir -p .git/info &&
32 printf "%s\n" _tmp actual expected >.git/info/exclude &&
33 tg_test_create_branches <<-EOT &&
34 branch1
35 :::
37 t/branch1
38 branch1
40 branch2
41 :::
43 t/branch2
44 branch2
46 branch3
47 :::
49 t/branch3
50 branch3
52 branch4
53 :::
55 t/branch4
56 branch4
58 branch5
59 :::
61 t/branch5
62 branch5
64 t/primary
65 t/branch1
67 t/secondary
68 t/branch2
70 EOT
71 git checkout -f t/secondary &&
72 git clean -f &&
73 >f3 && >f4 && >f5 &&
74 git add f3 f4 f5 &&
75 test_tick &&
76 git commit -m "f3-5" &&
77 tg_test_create_branches <<-EOT &&
78 t/primary2
79 t/primary
81 t/secondary2
82 t/secondary
84 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}" "\$@"
95 EOT
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
102 sha1)
103 primarybase=8e476c63c7ef4558
104 secondarybase=8f7ce5c9f088954c
106 sha256)
107 primarybase=597e7c92a7237dd5
108 secondarybase=1ed0c61ee3ddc0dc
110 esac
112 test_expect_success LASTOK 'verify setup' '
113 cat <<-EOT >expected &&
114 t/branch3
115 branch3
117 t/branch4
118 branch4
120 t/branch5
121 branch5
123 t/primary2
124 t/primary
125 t/branch1
126 branch1
128 t/secondary2
129 t/secondary
130 t/branch2
131 branch2
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
152 Base: $primarybase
153 Depends: t/branch1
154 Up-to-date.
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
162 Base: $secondarybase
163 Depends: t/branch2
164 Up-to-date.
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 &&
174 echo file3 >f3 &&
175 git rm f4 f5 &&
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 &&
181 rm -f f3 &&
182 echo file4 >f4 &&
183 echo file5 >f5 &&
184 test_when_finished test_set_prereq SETUP
187 test_expect_success SETUP 'files' '
188 cat <<-EOT >expected &&
193 tg files >actual &&
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
217 sha1)
218 f1f2f3blob=e69de29bb2d1d643
220 sha256)
221 f1f2f3blob=473a0f4c3be8a936
223 esac
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
231 f3 | 0
232 f4 | 0
233 f5 | 0
234 3 files changed, 0 insertions(+), 0 deletions(-)
235 create mode 100644 f3
236 create mode 100644 f4
237 create mode 100644 f5
239 diff --git a/f3 b/f3
240 new file mode 100644
241 index 0000000000000000..$f1f2f3blob
242 diff --git a/f4 b/f4
243 new file mode 100644
244 index 0000000000000000..$f1f2f3blob
245 diff --git a/f5 b/f5
246 new file mode 100644
247 index 0000000000000000..$f1f2f3blob
250 tg: ($secondarybase..) t/secondary (depends on: t/branch2)
252 tg patch >actual &&
253 test_cmp actual expected
256 test_expect_success SETUP,LASTOK 'mail' '
257 PATH="$PWD/.git/dummy:$PATH" && export PATH &&
258 tg mail >actual &&
259 test_cmp actual expected
262 case "$test_hash_algo" in
263 sha1)
264 f3blob=7c8ac2f8d82a1eb5
266 sha256)
267 f3blob=7b6de9267ded53f0
269 esac
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
277 f3 | 1 +
278 1 file changed, 1 insertion(+)
279 create mode 100644 f3
281 diff --git a/f3 b/f3
282 new file mode 100644
283 index 0000000000000000..$f3blob
284 --- /dev/null
285 +++ b/f3
286 @@ -0,0 +1 @@
287 +file3
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
302 sha1)
303 f4blob=bfd6a6583f9a9ac5
304 f5blob=4806cb9df135782b
306 sha256)
307 f4blob=a76920b2c5d13460
308 f5blob=343656d54d3d9c28
310 esac
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
318 f4 | 1 +
319 f5 | 1 +
320 2 files changed, 2 insertions(+)
321 create mode 100644 f4
322 create mode 100644 f5
324 diff --git a/f4 b/f4
325 new file mode 100644
326 index 0000000000000000..$f4blob
327 --- /dev/null
328 +++ b/f4
329 @@ -0,0 +1 @@
330 +file4
331 diff --git a/f5 b/f5
332 new file mode 100644
333 index 0000000000000000..$f5blob
334 --- /dev/null
335 +++ b/f5
336 @@ -0,0 +1 @@
337 +file5
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 &&
354 tg prev >actual &&
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 &&
375 tg next >actual &&
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 &&
383 >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 &&
399 >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 &&
408 branch2
409 t/branch2
410 t/secondary
412 tg summary --deps-only >actual &&
413 test_cmp actual expected
416 test_expect_success SETUP 'summary --deps-only -i' '
417 cat <<-\EOT >expected &&
418 branch3
419 t/branch3
420 t/secondary
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 &&
428 branch4
429 branch5
430 t/branch4
431 t/branch5
432 t/secondary
434 tg summary --deps-only -w >actual &&
435 test_cmp actual expected
438 test_expect_success SETUP 'summary --deps' '
439 cat <<-\EOT >expected &&
440 t/branch1 branch1
441 t/branch2 branch2
442 t/branch3 branch3
443 t/branch4 branch4
444 t/branch5 branch5
445 t/primary t/branch1
446 t/primary2 t/primary
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 &&
456 t/branch1 branch1
457 t/branch2 branch2
458 t/branch3 branch3
459 t/branch4 branch4
460 t/branch5 branch5
461 t/primary t/branch1
462 t/primary2 t/primary
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 &&
472 t/branch1 branch1
473 t/branch2 branch2
474 t/branch3 branch3
475 t/branch4 branch4
476 t/branch5 branch5
477 t/primary t/branch1
478 t/primary2 t/primary
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 &&
489 t/branch3
490 branch3
492 t/branch4
493 branch4
495 t/branch5
496 branch5
498 t/primary2
499 t/primary
500 t/branch1
501 branch1
503 t/secondary2
504 t/secondary
505 t/branch2
506 branch2
508 tg summary --rdeps --heads >actual &&
509 test_cmp actual expected
512 test_expect_success SETUP 'summary --rdeps --heads -i' '
513 cat <<\EOT >expected &&
514 t/branch2
515 branch2
517 t/branch4
518 branch4
520 t/branch5
521 branch5
523 t/primary2
524 t/primary
525 t/branch1
526 branch1
528 t/secondary2
529 t/secondary
530 t/branch3
531 branch3
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 &&
539 t/branch2
540 branch2
542 t/branch3
543 branch3
545 t/primary2
546 t/primary
547 t/branch1
548 branch1
550 t/secondary2
551 t/secondary
552 t/branch4
553 branch4
554 t/branch5
555 branch5
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
698 Base: $secondarybase
699 Depends: t/branch2
700 Up-to-date.
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
710 Base: $secondarybase
711 Depends: t/branch3
712 Needs update from:
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
723 Base: $secondarybase
724 Depends: t/branch4
725 t/branch5
726 Needs update from:
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
739 Base: $secondarybase
740 Depends: t/branch2
741 Up-to-date.
743 trim tg info -v >actual &&
744 test_cmp actual expected
747 case "$test_hash_algo" in
748 sha1)
749 quaternarybase=8f7ce5c9f088954c
750 branch2base=64ef3d8ae1560635
751 branch3base=231a8797a3d0de74
752 branch4base=f6890848ee0253af
753 branch5base=261e548eac1f8d28
755 sha256)
756 quaternarybase=1ed0c61ee3ddc0dc
757 branch2base=341670e4d25e58c8
758 branch3base=80b378eef7859f1e
759 branch4base=6d0162e00d6052c2
760 branch5base=864390011614c02a
762 esac
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
769 Base: $secondarybase
770 Depends: t/branch3
771 Needs update from:
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
780 Base: $branch3base
781 Depends: branch3
782 Up-to-date.
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
789 Dependents: [none]
790 Base: $branch2base
791 Depends: branch2
792 Up-to-date.
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
804 Depends: t/branch4
805 t/branch5
806 Needs update from:
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
816 Base: $branch4base
817 Depends: branch4
818 Up-to-date.
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
826 Base: $branch5base
827 Depends: branch5
828 Up-to-date.
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
835 Dependents: [none]
836 Base: $branch2base
837 Depends: branch2
838 Up-to-date.
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
849 Base: $secondarybase
850 Depends: t/branch2
851 Up-to-date.
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
862 Base: $secondarybase
863 Depends: t/branch3
864 Needs update from:
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]
873 Base: $branch3base
874 Depends: branch3
875 Up-to-date.
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
882 Dependents: [none]
883 Base: $branch2base
884 Depends: branch2
885 Up-to-date.
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
896 Base: $secondarybase
897 Depends: t/branch4
898 t/branch5
899 Needs update from:
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]
909 Base: $branch4base
910 Depends: branch4
911 Up-to-date.
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]
919 Base: $branch5base
920 Depends: branch5
921 Up-to-date.
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
928 Dependents: [none]
929 Base: $branch2base
930 Depends: branch2
931 Up-to-date.
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 &&
939 t/branch2
941 tg info --dependencies >actual &&
942 test_cmp actual expected
945 test_expect_success SETUP 'info --dependencies -i' '
946 cat <<-\EOT >expected &&
947 t/branch3
949 tg info --dependencies -i >actual &&
950 test_cmp actual expected
953 test_expect_success SETUP 'info --dependencies -w' '
954 cat <<-\EOT >expected &&
955 t/branch4
956 t/branch5
958 tg info --dependencies -w >actual &&
959 test_cmp actual expected
962 test_expect_success SETUP 'info --dependents' '
963 cat <<-\EOT >expected &&
964 t/secondary2
966 tg info --dependents >actual &&
967 test_cmp actual expected &&
968 cat <<-\EOT >expected &&
969 t/secondary
971 tg info --dependents t/branch2 >actual &&
972 test_cmp actual expected
975 test_expect_success SETUP 'info --dependents -i' '
976 cat <<-\EOT >expected &&
977 t/secondary2
979 tg info --dependents -i >actual &&
980 test_cmp actual expected &&
981 cat <<-\EOT >expected &&
982 t/secondary
984 tg info --dependents -i t/branch3 >actual &&
985 test_cmp actual expected &&
986 >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 &&
997 t/secondary2
999 tg info --dependents -w >actual &&
1000 test_cmp actual expected &&
1001 cat <<-\EOT >expected &&
1002 t/secondary
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 &&
1008 >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 &&
1048 refs/heads/branch2
1050 tg info --leaves >actual &&
1051 test_cmp actual expected
1054 test_expect_success SETUP 'info --leaves -i' '
1055 cat <<-\EOT >expected &&
1056 refs/heads/branch3
1058 tg info --leaves -i >actual &&
1059 test_cmp actual expected
1062 test_expect_success SETUP 'info --leaves -w' '
1063 cat <<-\EOT >expected &&
1064 refs/heads/branch4
1065 refs/heads/branch5
1067 tg info --leaves -w >actual &&
1068 test_cmp actual expected
1071 test_expect_success SETUP 'info --heads' '
1072 cat <<-\EOT >expected &&
1073 t/secondary2
1075 tg info --heads >actual &&
1076 test_cmp actual expected
1079 test_expect_success SETUP 'info --heads -i' '
1080 cat <<-\EOT >expected &&
1081 t/secondary2
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 &&
1088 t/branch2
1090 tg info --heads -i t/branch2 >actual &&
1091 cat <<-\EOT >expected &&
1092 t/branch4
1094 tg info --heads -i t/branch4 >actual &&
1095 test_cmp actual expected &&
1096 cat <<-\EOT >expected &&
1097 t/branch5
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 &&
1105 t/secondary2
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 &&
1114 t/branch2
1116 tg info --heads -w t/branch2 >actual &&
1117 test_cmp actual expected &&
1118 cat <<-\EOT >expected &&
1119 t/branch3
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 &&
1133 t/secondary2
1135 tg info --heads >actual &&
1136 test_cmp actual expected
1139 test_expect_success SETUP2 'detached info --heads -i' '
1140 cat <<-\EOT >expected &&
1141 t/secondary2
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 &&
1148 t/branch3
1150 tg info --heads -i t/branch3 >actual &&
1151 test_cmp actual expected &&
1152 cat <<-\EOT >expected &&
1153 t/branch4
1155 tg info --heads -i t/branch4 >actual &&
1156 test_cmp actual expected &&
1157 cat <<-\EOT >expected &&
1158 t/branch5
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 &&
1166 t/secondary2
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 &&
1173 t/branch3
1175 tg info --heads -w t/branch3 >actual &&
1176 test_cmp actual expected &&
1177 cat <<-\EOT >expected &&
1178 t/branch4
1180 tg info --heads -w t/branch4 >actual &&
1181 test_cmp actual expected &&
1182 cat <<-\EOT >expected &&
1183 t/branch5
1185 tg info --heads -w t/branch5 >actual &&
1186 test_cmp actual expected
1189 test_done