3 test_description
='test tg info --leaves functionality'
9 test_expect_success
'setup' '
10 tg_test_create_branches <<-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^ &&
102 git tag five-tagged-light-1 five^ &&
104 git tag -am tagged5 five-tagged five^ &&
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
172 refs/tags/four-tagged
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