README_DOCS.rst: update tg prev and tg next usage summary
[topgit/pro.git] / t / t4300-info-leaves.sh
blob43c2e36776c48079119dfe0ce93f529d4ee5442c
1 #!/bin/sh
3 test_description='test tg info --leaves functionality'
5 . ./test-lib.sh
7 test_plan 12
9 test_expect_success 'setup' '
10 tg_test_create_branches <<-EOT &&
11 one
12 :::
14 two
15 :::
17 three
18 :::
20 two-plus-two
21 :::two
23 +two-plus-two
24 :::two-plus-two
26 four
27 :::
29 +four
30 :::four
32 t/base-four-up-up
33 :four
35 +four
36 :::four
38 t/base-four-up
39 :four
41 +four
42 :::four
44 five
45 :::
47 +five
48 :::five
50 t/base-five
51 :five
53 +five
54 :::five
56 t/one
57 one
59 t/two
60 two
62 t/three
63 three
65 t/two-deps
66 one
67 two
69 t/three-deps
70 one
71 two
72 three
74 t/three-two
75 t/three
76 t/two
78 whatever
79 :::
81 t/annihilated
82 whatever
84 t/complex
85 two-plus-two
86 one
87 t/base-four-up
88 t/three-two
90 t/complex-too
91 two-plus-two
92 one
93 t/annihilated
94 t/base-four-up
95 t/three-two
96 EOT
97 newcmt="$(git commit-tree -m annihilate $(tg base t/annihilated)^{tree})" &&
98 git update-ref refs/heads/t/annihilated "$newcmt" refs/heads/t/annihilated &&
99 git tag four-tagged-light four^^ &&
100 git tag -am tagged four-tagged four^ &&
101 test_tick &&
102 git tag five-tagged-light-1 five^ &&
103 test_tick &&
104 git tag -am tagged5 five-tagged five^ &&
105 test_tick &&
106 git tag five-tagged-light-2 five^ &&
107 test_when_finished test_set_prereq SETUP
110 test_expect_success SETUP 'one leaf' '
111 echo refs/heads/one >expected &&
112 tg info --leaves t/one >actual &&
113 test_cmp actual expected
116 test_expect_success SETUP 'two leaf' '
117 echo refs/heads/two >expected &&
118 tg info --leaves t/two >actual &&
119 test_cmp actual expected
122 test_expect_success SETUP 'three leaf' '
123 echo refs/heads/three >expected &&
124 tg info --leaves t/three >actual &&
125 test_cmp actual expected
128 test_expect_success SETUP 'two leaves' '
129 echo refs/heads/one >expected &&
130 echo refs/heads/two >>expected &&
131 tg info --leaves t/two-deps >actual &&
132 test_cmp actual expected
135 test_expect_success SETUP 'three leaves' '
136 echo refs/heads/one >expected &&
137 echo refs/heads/two >>expected &&
138 echo refs/heads/three >>expected &&
139 tg info --leaves t/three-deps >actual &&
140 test_cmp actual expected
143 test_expect_success SETUP 'two leaves backwards' '
144 echo refs/heads/three >expected &&
145 echo refs/heads/two >>expected &&
146 tg info --leaves t/three-two >actual &&
147 test_cmp actual expected
150 test_expect_success SETUP 'one lightweight base' '
151 echo refs/tags/four-tagged-light >expected &&
152 tg info --leaves t/base-four-up-up >actual &&
153 test_cmp actual expected
156 test_expect_success SETUP 'one annotated base' '
157 echo refs/tags/four-tagged >expected &&
158 tg info --leaves t/base-four-up >actual &&
159 test_cmp actual expected
162 test_expect_success SETUP 'one multi-tagged base' '
163 echo refs/tags/five-tagged >expected &&
164 tg info --leaves t/base-five >actual &&
165 test_cmp actual expected
168 test_expect_success SETUP 'complex leaves' '
169 cat <<-EOT >expected-complex &&
170 refs/heads/two-plus-two
171 refs/heads/one
172 refs/tags/four-tagged
173 refs/heads/three
174 refs/heads/two
176 test_when_finished test_set_prereq EXPCMPX &&
177 tg info --leaves t/complex >actual &&
178 test_cmp actual expected-complex
181 test_expect_success 'SETUP EXPCMPX' 'complex leaves w/o annihilated' '
182 test -s expected-complex &&
183 tg info --leaves t/complex-too >actual &&
184 test_cmp actual expected-complex
187 test_done