README_DOCS.rst: update tg prev and tg next usage summary
[topgit/pro.git] / t / t6120-tag-stash.sh
blobc335b35f06bf1efdf01f500d5b54a78a7e236aef
1 #!/bin/sh
3 test_description='test tg tag creation'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 init_gpg2_dir() {
10 printf '%s\n' "use-agent" "pinentry-mode loopback" >"$GNUPGHOME/gpg.conf" &&
11 printf '%s\n' "allow-loopback-pinentry" >"$GNUPGHOME/gpg-agent.conf"
14 GNUPGHOME="$PWD/gnupg" &&
15 mkdir "$GNUPGHOME" &&
16 test -d "$GNUPGHOME" &&
17 chmod go-rwx "$GNUPGHOME" &&
18 export GNUPGHOME &&
19 { ! command -v gpgconf >/dev/null 2>&1 || gpgconf --kill gpg-agent >/dev/null 2>&1 || :; } || die
21 gpgscript="$PWD/gpg-sign.sh"
22 gitgpg() {
23 git -c gpg.program="$gpgscript" "$@"
25 tggpg() {
26 tg -c gpg.program="$gpgscript" "$@"
29 test_plan 40
31 test_tolerate_failure 'gpg check and setup' '
32 if gpg --version; then
33 gpgvers="$(gpg --version | head -n 1)" &&
34 gpgvers_jnk="${gpgvers%%[0-9]*}" gpgvers="${gpgvers#$gpgvers_jnk}" &&
35 gpgvers="${gpgvers%%[!0-9.]*}" &&
36 case "$gpgvers" in
37 ""|1|1.*)
38 gpg --import "$TEST_DIRECTORY/$this_test/framework-key.gpg"
41 init_gpg2_dir &&
42 gpg --batch --passphrase "framework" --import "$TEST_DIRECTORY/$this_test/framework-key.gpg"
44 esac &&
45 gpg --import-ownertrust "$TEST_DIRECTORY/$this_test/framework-key.trust" &&
46 write_script "$gpgscript" <<-\EOT &&
47 exec gpg --batch --passphrase "framework" "$@"
48 EOT
49 test_create_repo gpg-repo &&
50 cd gpg-repo &&
51 test_commit gpg &&
52 gitgpg tag -s -m "signed tag" signed-tag &&
53 git tag -v signed-tag &&
54 test_when_finished test_set_prereq GPG
58 if test_have_prereq GPG; then
59 test_expect_success GPG 'gpg tests enabled' ': # gpg available and tested'
60 else
61 test_expect_success !GPG 'gpg tests disabled' ': # gpg not available'
64 test_expect_success 'setup' '
65 test_create_repo empty &&
66 test_create_repo tgonly &&
67 test_create_repo nontg &&
68 test_create_repo both &&
69 test_create_repo outdated &&
70 test_create_repo ann &&
71 cd nontg &&
72 test_commit one &&
73 test_commit two &&
74 git read-tree --empty &&
75 git symbolic-ref HEAD refs/heads/other &&
76 test_commit o1 &&
77 test_commit o2 &&
78 cd ../tgonly &&
79 tg_test_create_branch t/branch1 : &&
80 git checkout -f t/branch1 &&
81 test_commit tgb1a &&
82 test_commit tgb1b &&
83 tg_test_create_branch t/branch2 : &&
84 git checkout -f t/branch2 &&
85 test_commit tgb2a &&
86 test_commit tgb2b &&
87 cd ../both &&
88 test_commit m1 &&
89 test_commit m2 &&
90 git read-tree --empty &&
91 git symbolic-ref HEAD refs/heads/other &&
92 test_commit o1 &&
93 test_commit o2 &&
94 git read-tree --empty &&
95 git symbolic-ref HEAD "$(tg --top-bases)/t/orphanbase" &&
96 test_commit tgorphanbase &&
97 git read-tree --empty &&
98 git symbolic-ref HEAD refs/heads/tgbranch1 &&
99 test_commit tgbefore1 &&
100 tg_test_create_branch t/both1 tgbranch1 &&
101 git checkout -f t/both1 &&
102 test_commit both1 &&
103 git read-tree --empty &&
104 git symbolic-ref HEAD refs/heads/tgbranch2 &&
105 test_commit tgbefore2 &&
106 tg_test_create_branch t/both2 tgbranch2 &&
107 git checkout -f t/both2 &&
108 test_commit both2 &&
109 cd ../outdated &&
110 test_commit first &&
111 tg_test_create_branch t/branch master &&
112 test_commit second &&
113 cd ../ann &&
114 git read-tree --empty &&
115 git symbolic-ref HEAD refs/heads/base1 &&
116 test_commit base1 &&
117 git read-tree --empty &&
118 git symbolic-ref HEAD refs/heads/base2 &&
119 test_commit base2 &&
120 tg_test_create_branch t/branch1 base1 &&
121 git checkout -f t/branch1 &&
122 test_commit branch1 &&
123 anc="$(git commit-tree -m "annihilate" -p HEAD "$(git rev-parse --verify "$(tg --top-bases)/t/branch1^{tree}" --)")" &&
124 test -n "$anc" &&
125 git update-ref -m "annihilate branch" HEAD "$anc" HEAD &&
126 tg_test_create_branch t/hold1 t/branch1 &&
127 tg_test_create_branch t/branch2 base2 &&
128 git checkout -f t/branch2 &&
129 test_commit branch2 &&
130 tg_test_create_branch t/hold2 t/branch2 &&
131 tg_test_create_branch t/holdboth t/branch1 t/branch2 &&
132 test_when_finished test_set_prereq SETUP
135 test_expect_success SETUP 'empty fails' '
136 cd empty &&
137 test_must_fail tg tag --refs &&
138 test_must_fail tg tag --refs --all &&
139 test_must_fail tg tag --stash &&
140 test_must_fail tg tag --stash --all &&
141 test_must_fail tg tag --anonymous &&
142 test_must_fail tg tag --anonymous --all &&
143 test_must_fail tg tag foo &&
144 test_must_fail tg tag foo --all
147 test_expect_success SETUP 'empty --allow-any fails' '
148 cd empty &&
149 test_must_fail tg tag --allow-any --refs &&
150 test_must_fail tg tag --allow-any --refs --all &&
151 test_must_fail tg tag --allow-any --stash &&
152 test_must_fail tg tag --allow-any --stash --all &&
153 test_must_fail tg tag --allow-any --anonymous &&
154 test_must_fail tg tag --allow-any --anonymous --all &&
155 test_must_fail tg tag --allow-any foo &&
156 test_must_fail tg tag --allow-any foo --all
159 test_expect_success SETUP 'empty --none-ok fails' '
160 cd empty &&
161 test_must_fail tg tag --none-ok --refs &&
162 test_must_fail tg tag --none-ok --refs --all &&
163 test_must_fail tg tag --none-ok --stash &&
164 test_must_fail tg tag --none-ok --stash --all &&
165 tg tag --none-ok --anonymous && # --anonymous implies --quiet
166 tg tag --none-ok --anonymous --all && # --anonymous implies --quiet
167 test_must_fail tg tag --none-ok foo &&
168 test_must_fail tg tag --none-ok foo --all
171 test_expect_success SETUP 'empty --none-ok --quiet succeeds' '
172 cd empty &&
173 test_must_fail tg tag --none-ok --quiet --refs && # bad HEAD
174 tg tag --none-ok --quiet --refs --all &&
175 tg tag --none-ok --quiet --stash &&
176 tg tag --none-ok --quiet --stash --all &&
177 tg tag --none-ok --quiet --anonymous &&
178 tg tag --none-ok --quiet --anonymous --all &&
179 test_must_fail tg tag --none-ok --quiet foo && # bad HEAD
180 tg tag --none-ok --quiet foo --all
183 test_expect_success SETUP 'empty --none-ok --quiet --quiet succeeds' '
184 cd empty &&
185 test_must_fail tg tag --none-ok --quiet --quiet --refs && # bad HEAD
186 tg tag --none-ok --quiet --quiet --refs --all &&
187 tg tag --none-ok --quiet --quiet --stash &&
188 tg tag --none-ok --quiet --quiet --stash --all &&
189 tg tag --none-ok --quiet --quiet --anonymous &&
190 tg tag --none-ok --quiet --quiet --anonymous --all &&
191 test_must_fail tg tag --none-ok --quiet --quiet foo && # bad HEAD
192 tg tag --none-ok --quiet foo --all
195 test_expect_success SETUP 'nontg fails' '
196 cd nontg &&
197 test_must_fail tg tag --refs &&
198 test_must_fail tg tag --refs --all &&
199 test_must_fail tg tag --stash &&
200 test_must_fail tg tag --stash --all &&
201 test_must_fail tg tag --anonymous &&
202 test_must_fail tg tag --anonymous --all &&
203 test_must_fail tg tag foo &&
204 test_must_fail tg tag foo --all
207 test_expect_success SETUP 'nontg --allow-any succeeds' '
208 cd nontg &&
209 tg tag --allow-any --refs &&
210 tg tag --allow-any --refs --all &&
211 tg tag --allow-any --stash &&
212 tg tag --allow-any --stash --all &&
213 tg tag --allow-any --anonymous &&
214 tg tag --allow-any --anonymous --all &&
215 tg tag --allow-any foonon-1 &&
216 tg tag --allow-any foonon-2 --all
219 test_expect_success SETUP 'tgonly succeeds' '
220 cd tgonly &&
221 tg tag --refs &&
222 tg tag --refs --all &&
223 tg tag --stash &&
224 tg tag --stash --all &&
225 tg tag --anonymous &&
226 tg tag --anonymous --all &&
227 tg tag fooonly-1 &&
228 tg tag fooonly-2 --all
231 test_expect_success SETUP 'both succeeds' '
232 cd both &&
233 tg tag --refs &&
234 tg tag --refs --all &&
235 tg tag --stash &&
236 tg tag --stash --all &&
237 tg tag --anonymous &&
238 tg tag --anonymous --all &&
239 tg tag fooboth-1 &&
240 tg tag fooboth-2 --all
243 test_expect_success SETUP 'non-stash outdated needs --allow-outdated' '
244 cd outdated &&
245 test_must_fail tg tag --refs t/branch &&
246 test_must_fail tg tag sometag t/branch &&
247 tg tag --allow-outdated --refs t/branch >/dev/null &&
248 tg tag --allow-outdated sometag t/branch
251 test_expect_success SETUP '--stash allows outdated' '
252 cd outdated &&
253 tg tag --stash t/branch &&
254 tg tag --anonymous t/branch
257 test_expect_success SETUP '--stash --all allows outdated' '
258 cd outdated &&
259 tg tag --stash &&
260 tg tag --stash t/branch &&
261 tg tag --anonymous &&
262 tg tag --anonymous t/branch
265 test_expect_success SETUP 'non-stash --all allows outdated' '
266 cd outdated &&
267 tg tag --refs --all &&
268 tg tag alltag --all
271 test_expect_success SETUP 'replace requires -f' '
272 cd both &&
273 test_must_fail git rev-parse --verify --quiet replaceme -- >/dev/null &&
274 tg tag replaceme &&
275 git rev-parse --verify --quiet replaceme -- >/dev/null &&
276 test_must_fail tg tag replaceme &&
277 tg tag -f replaceme &&
278 git rev-parse --verify --quiet replaceme -- >/dev/null
281 test_expect_success SETUP 'HEAD --refs' '
282 cd both &&
283 case "$test_hash_algo" in
284 sha1)
285 cat <<-EOT >expected
286 -----BEGIN TOPGIT REFS-----
287 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
288 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
289 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
290 -----END TOPGIT REFS-----
293 sha256)
294 cat <<-EOT >expected
295 -----BEGIN TOPGIT REFS-----
296 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
297 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
298 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
299 -----END TOPGIT REFS-----
301 ;;*) die unknown hash "$test_hash_algo"
302 esac &&
303 tg tag --refs >actual &&
304 test_cmp actual expected &&
305 tg tag --refs HEAD >actual &&
306 test_cmp actual expected &&
307 tg tag --refs @ >actual &&
308 test_cmp actual expected &&
309 tg tag --refs @ HEAD >actual &&
310 test_cmp actual expected &&
311 tg tag --refs HEAD @ >actual &&
312 test_cmp actual expected &&
313 tg tag --refs HEAD HEAD >actual &&
314 test_cmp actual expected &&
315 tg tag --refs @ @ >actual &&
316 test_cmp actual expected
319 test_expect_success SETUP 't/both2 --refs' '
320 cd both &&
321 case "$test_hash_algo" in
322 sha1)
323 cat <<-EOT >expected
324 -----BEGIN TOPGIT REFS-----
325 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
326 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
327 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
328 -----END TOPGIT REFS-----
331 sha256)
332 cat <<-EOT >expected
333 -----BEGIN TOPGIT REFS-----
334 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
335 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
336 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
337 -----END TOPGIT REFS-----
339 ;;*) die unknown hash "$test_hash_algo"
340 esac &&
341 tg tag --refs t/both2 >actual &&
342 test_cmp actual expected &&
343 tg tag --refs t/both2 t/both2 >actual &&
344 test_cmp actual expected
347 test_expect_success SETUP 't/both1 --refs' '
348 cd both &&
349 case "$test_hash_algo" in
350 sha1)
351 cat <<-EOT >expected
352 -----BEGIN TOPGIT REFS-----
353 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
354 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
355 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
356 -----END TOPGIT REFS-----
359 sha256)
360 cat <<-EOT >expected
361 -----BEGIN TOPGIT REFS-----
362 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
363 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
364 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
365 -----END TOPGIT REFS-----
367 ;;*) die unknown hash "$test_hash_algo"
368 esac &&
369 tg tag --refs t/both1 >actual &&
370 test_cmp actual expected &&
371 tg tag --refs t/both1 t/both1 >actual &&
372 test_cmp actual expected
375 test_expect_success SETUP 't/orphanbase --refs' '
376 cd both &&
377 case "$test_hash_algo" in
378 sha1)
379 cat <<-EOT >expected
380 -----BEGIN TOPGIT REFS-----
381 8b5716e97e03bafa97f7a5e7e0e155305dccac02 refs/top-bases/t/orphanbase
382 -----END TOPGIT REFS-----
385 sha256)
386 cat <<-EOT >expected
387 -----BEGIN TOPGIT REFS-----
388 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 refs/top-bases/t/orphanbase
389 -----END TOPGIT REFS-----
391 ;;*) die unknown hash "$test_hash_algo"
392 esac &&
393 test_must_fail tg tag --refs t/orphanbase &&
394 test_must_fail tg tag --refs refs/heads/t/orphanbase &&
395 tg tag --refs "$(tg --top-bases)"/t/orphanbase >actual &&
396 test_cmp actual expected
399 test_expect_success SETUP 't/both1 t/both2 --refs' '
400 cd both &&
401 case "$test_hash_algo" in
402 sha1)
403 cat <<-EOT >expected
404 -----BEGIN TOPGIT REFS-----
405 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
406 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
407 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
408 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
409 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
410 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
411 -----END TOPGIT REFS-----
414 sha256)
415 cat <<-EOT >expected
416 -----BEGIN TOPGIT REFS-----
417 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
418 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
419 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
420 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
421 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
422 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
423 -----END TOPGIT REFS-----
425 ;;*) die unknown hash "$test_hash_algo"
426 esac &&
427 tg tag --refs t/both1 t/both2 >actual &&
428 test_cmp actual expected &&
429 tg tag --refs t/both2 t/both1 >actual &&
430 test_cmp actual expected
433 test_expect_success SETUP 't/both1 {base}t/orphanbase --refs' '
434 cd both &&
435 case "$test_hash_algo" in
436 sha1)
437 cat <<-EOT >expected
438 -----BEGIN TOPGIT REFS-----
439 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
440 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
441 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
442 8b5716e97e03bafa97f7a5e7e0e155305dccac02 refs/top-bases/t/orphanbase
443 -----END TOPGIT REFS-----
446 sha256)
447 cat <<-EOT >expected
448 -----BEGIN TOPGIT REFS-----
449 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
450 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
451 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
452 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 refs/top-bases/t/orphanbase
453 -----END TOPGIT REFS-----
455 ;;*) die unknown hash "$test_hash_algo"
456 esac &&
457 tg tag --refs t/both1 "$(tg --top-bases)/t/orphanbase" >actual &&
458 test_cmp actual expected &&
459 tg tag --refs "$(tg --top-bases)/t/orphanbase" t/both1 >actual &&
460 test_cmp actual expected
463 test_expect_success SETUP 't/both1 {base}t/orphanbase t/both2 --refs' '
464 cd both &&
465 case "$test_hash_algo" in
466 sha1)
467 cat <<-EOT >expected
468 -----BEGIN TOPGIT REFS-----
469 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
470 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
471 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
472 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
473 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
474 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
475 8b5716e97e03bafa97f7a5e7e0e155305dccac02 refs/top-bases/t/orphanbase
476 -----END TOPGIT REFS-----
479 sha256)
480 cat <<-EOT >expected
481 -----BEGIN TOPGIT REFS-----
482 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
483 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
484 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
485 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
486 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
487 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
488 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 refs/top-bases/t/orphanbase
489 -----END TOPGIT REFS-----
491 ;;*) die unknown hash "$test_hash_algo"
492 esac &&
493 tg tag --refs t/both1 "$(tg --top-bases)/t/orphanbase" t/both2 >actual &&
494 test_cmp actual expected &&
495 tg tag --refs "$(tg --top-bases)/t/orphanbase" t/both1 t/both2 >actual &&
496 test_cmp actual expected &&
497 tg tag --refs t/both2 t/both1 "$(tg --top-bases)/t/orphanbase" >actual &&
498 test_cmp actual expected
501 test_expect_success SETUP 'explicit non-tgish fails --refs' '
502 cd both &&
503 test_must_fail tg tag --refs master &&
504 test_must_fail tg tag --refs other &&
505 test_must_fail tg tag --refs refs/heads/master &&
506 test_must_fail tg tag --refs refs/heads/other &&
507 test_must_fail tg tag --refs master other &&
508 test_must_fail tg tag --refs other master &&
509 test_must_fail tg tag --refs other refs/heads/master &&
510 test_must_fail tg tag --refs refs/heads/other master
513 test_expect_success SETUP 'explicit non-tgish succeeds --allow-any --refs' '
514 cd both &&
515 case "$test_hash_algo" in
516 sha1)
517 cat <<-EOT >expected
518 -----BEGIN TOPGIT REFS-----
519 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
520 -----END TOPGIT REFS-----
523 sha256)
524 cat <<-EOT >expected
525 -----BEGIN TOPGIT REFS-----
526 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
527 -----END TOPGIT REFS-----
529 ;;*) die unknown hash "$test_hash_algo"
530 esac &&
531 tg tag --allow-any --refs master >actual &&
532 test_cmp actual expected &&
533 tg tag --allow-any --refs refs/heads/master >actual &&
534 test_cmp actual expected &&
535 case "$test_hash_algo" in
536 sha1)
537 cat <<-EOT >expected
538 -----BEGIN TOPGIT REFS-----
539 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
540 -----END TOPGIT REFS-----
543 sha256)
544 cat <<-EOT >expected
545 -----BEGIN TOPGIT REFS-----
546 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
547 -----END TOPGIT REFS-----
549 ;;*) die unknown hash "$test_hash_algo"
550 esac &&
551 tg tag --allow-any --refs other >actual &&
552 test_cmp actual expected &&
553 tg tag --allow-any --refs refs/heads/other >actual &&
554 test_cmp actual expected &&
555 case "$test_hash_algo" in
556 sha1)
557 cat <<-EOT >expected
558 -----BEGIN TOPGIT REFS-----
559 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
560 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
561 -----END TOPGIT REFS-----
564 sha256)
565 cat <<-EOT >expected
566 -----BEGIN TOPGIT REFS-----
567 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
568 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
569 -----END TOPGIT REFS-----
571 ;;*) die unknown hash "$test_hash_algo"
572 esac &&
573 tg tag --allow-any --refs master other >actual &&
574 test_cmp actual expected &&
575 tg tag --allow-any --refs other master >actual &&
576 test_cmp actual expected &&
577 tg tag --allow-any --refs other refs/heads/master >actual &&
578 test_cmp actual expected &&
579 tg tag --allow-any --refs refs/heads/other master >actual &&
580 test_cmp actual expected
583 test_expect_success SETUP 't/both1 master --refs needs --allow-any' '
584 cd both &&
585 case "$test_hash_algo" in
586 sha1)
587 cat <<-EOT >expected
588 -----BEGIN TOPGIT REFS-----
589 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
590 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
591 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
592 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
593 -----END TOPGIT REFS-----
596 sha256)
597 cat <<-EOT >expected
598 -----BEGIN TOPGIT REFS-----
599 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
600 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
601 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
602 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
603 -----END TOPGIT REFS-----
605 ;;*) die unknown hash "$test_hash_algo"
606 esac &&
607 test_must_fail tg tag --refs t/both1 master &&
608 test_must_fail tg tag --refs master t/both1 &&
609 tg tag --allow-any --refs t/both1 master >actual &&
610 test_cmp actual expected &&
611 tg tag --allow-any --refs master t/both1 >actual &&
612 test_cmp actual expected
615 test_expect_success SETUP '--all refs impliclt and explicit' '
616 cd both &&
617 case "$test_hash_algo" in
618 sha1)
619 cat <<-EOT >expected
620 -----BEGIN TOPGIT REFS-----
621 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
622 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
623 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
624 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
625 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
626 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
627 8b5716e97e03bafa97f7a5e7e0e155305dccac02 refs/top-bases/t/orphanbase
628 -----END TOPGIT REFS-----
631 sha256)
632 cat <<-EOT >expected
633 -----BEGIN TOPGIT REFS-----
634 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
635 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
636 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
637 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
638 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
639 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
640 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 refs/top-bases/t/orphanbase
641 -----END TOPGIT REFS-----
643 ;;*) die unknown hash "$test_hash_algo"
644 esac &&
645 tg tag --all --refs >actual &&
646 test_cmp actual expected &&
647 tg tag --refs --all >actual &&
648 test_cmp actual expected &&
649 tg tag --refs t/both1 t/both2 "$(tg --top-bases)/t/orphanbase" >actual &&
650 test_cmp actual expected
653 test_expect_success SETUP '--allow-any --all refs impliclt and explicit' '
654 cd both &&
655 case "$test_hash_algo" in
656 sha1)
657 cat <<-EOT >expected
658 -----BEGIN TOPGIT REFS-----
659 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
660 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
661 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
662 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
663 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
664 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
665 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/top-bases/t/both1
666 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/top-bases/t/both2
667 8b5716e97e03bafa97f7a5e7e0e155305dccac02 refs/top-bases/t/orphanbase
668 -----END TOPGIT REFS-----
671 sha256)
672 cat <<-EOT >expected
673 -----BEGIN TOPGIT REFS-----
674 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
675 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
676 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
677 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
678 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
679 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
680 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/top-bases/t/both1
681 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/top-bases/t/both2
682 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 refs/top-bases/t/orphanbase
683 -----END TOPGIT REFS-----
685 ;;*) die unknown hash "$test_hash_algo"
686 esac &&
687 tg tag --all --refs >actual &&
688 test_must_fail test_cmp actual expected &&
689 tg tag --refs --all >actual &&
690 test_must_fail test_cmp actual expected &&
691 tg tag --refs t/both1 t/both2 "$(tg --top-bases)/t/orphanbase" >actual &&
692 test_must_fail test_cmp actual expected &&
693 tg tag --allow-any --all --refs >actual &&
694 test_cmp actual expected &&
695 tg tag --allow-any --refs --all >actual &&
696 test_cmp actual expected &&
697 test_must_fail tg tag --refs master other t/both1 t/both2 "$(tg --top-bases)/t/orphanbase" &&
698 tg tag --allow-any --refs master other t/both1 t/both2 "$(tg --top-bases)/t/orphanbase" >actual &&
699 test_cmp actual expected
702 test_expect_success SETUP 'annihilated --all' '
703 cd ann &&
704 case "$test_hash_algo" in
705 sha1)
706 cat <<-EOT >expected
707 -----BEGIN TOPGIT REFS-----
708 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
709 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
710 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
711 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
712 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
713 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
714 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/top-bases/t/branch1
715 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/top-bases/t/branch2
716 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/hold1
717 e6f05ae1f7586c2efc3816a2e6c806e109c9026a refs/top-bases/t/hold2
718 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/holdboth
719 -----END TOPGIT REFS-----
722 sha256)
723 cat <<-EOT >expected
724 -----BEGIN TOPGIT REFS-----
725 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
726 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
727 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
728 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
729 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
730 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
731 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/top-bases/t/branch1
732 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/top-bases/t/branch2
733 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/hold1
734 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 refs/top-bases/t/hold2
735 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/holdboth
736 -----END TOPGIT REFS-----
738 ;;*) die unknown hash "$test_hash_algo"
739 esac &&
740 tg tag --refs --all >actual &&
741 test_cmp actual expected
744 test_expect_success SETUP 'annihilated --allow-any --all' '
745 cd ann &&
746 case "$test_hash_algo" in
747 sha1)
748 cat <<-EOT >expected
749 -----BEGIN TOPGIT REFS-----
750 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/heads/base1
751 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
752 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
753 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
754 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
755 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
756 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
757 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/top-bases/t/branch1
758 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/top-bases/t/branch2
759 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/hold1
760 e6f05ae1f7586c2efc3816a2e6c806e109c9026a refs/top-bases/t/hold2
761 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/holdboth
762 -----END TOPGIT REFS-----
765 sha256)
766 cat <<-EOT >expected
767 -----BEGIN TOPGIT REFS-----
768 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/heads/base1
769 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
770 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
771 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
772 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
773 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
774 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
775 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/top-bases/t/branch1
776 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/top-bases/t/branch2
777 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/hold1
778 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 refs/top-bases/t/hold2
779 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/holdboth
780 -----END TOPGIT REFS-----
782 ;;*) die unknown hash "$test_hash_algo"
783 esac &&
784 tg tag --allow-any --refs --all >actual &&
785 test_cmp actual expected
788 test_expect_success SETUP 'annihilated t/branch1' '
789 cd ann &&
790 case "$test_hash_algo" in
791 sha1)
792 cat <<-EOT >expected
793 -----BEGIN TOPGIT REFS-----
794 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
795 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/top-bases/t/branch1
796 -----END TOPGIT REFS-----
799 sha256)
800 cat <<-EOT >expected
801 -----BEGIN TOPGIT REFS-----
802 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
803 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/top-bases/t/branch1
804 -----END TOPGIT REFS-----
806 ;;*) die unknown hash "$test_hash_algo"
807 esac &&
808 tg tag --refs t/branch1 >actual &&
809 test_cmp actual expected
812 test_expect_success SETUP 'unannihilated t/branch2' '
813 cd ann &&
814 case "$test_hash_algo" in
815 sha1)
816 cat <<-EOT >expected
817 -----BEGIN TOPGIT REFS-----
818 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
819 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
820 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/top-bases/t/branch2
821 -----END TOPGIT REFS-----
824 sha256)
825 cat <<-EOT >expected
826 -----BEGIN TOPGIT REFS-----
827 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
828 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
829 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/top-bases/t/branch2
830 -----END TOPGIT REFS-----
832 ;;*) die unknown hash "$test_hash_algo"
833 esac &&
834 tg tag --refs t/branch2 >actual &&
835 test_cmp actual expected
838 test_expect_success SETUP 'annihilated t/branch1 in t/hold1' '
839 cd ann &&
840 case "$test_hash_algo" in
841 sha1)
842 cat <<-EOT >expected
843 -----BEGIN TOPGIT REFS-----
844 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
845 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
846 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/top-bases/t/branch1
847 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/hold1
848 -----END TOPGIT REFS-----
851 sha256)
852 cat <<-EOT >expected
853 -----BEGIN TOPGIT REFS-----
854 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
855 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
856 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/top-bases/t/branch1
857 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/hold1
858 -----END TOPGIT REFS-----
860 ;;*) die unknown hash "$test_hash_algo"
861 esac &&
862 tg tag --refs t/hold1 >actual &&
863 test_cmp actual expected
866 test_expect_success SETUP 'unannihilated t/branch2 in t/hold2' '
867 cd ann &&
868 case "$test_hash_algo" in
869 sha1)
870 cat <<-EOT >expected
871 -----BEGIN TOPGIT REFS-----
872 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
873 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
874 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
875 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/top-bases/t/branch2
876 e6f05ae1f7586c2efc3816a2e6c806e109c9026a refs/top-bases/t/hold2
877 -----END TOPGIT REFS-----
880 sha256)
881 cat <<-EOT >expected
882 -----BEGIN TOPGIT REFS-----
883 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
884 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
885 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
886 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/top-bases/t/branch2
887 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 refs/top-bases/t/hold2
888 -----END TOPGIT REFS-----
890 ;;*) die unknown hash "$test_hash_algo"
891 esac &&
892 tg tag --refs t/hold2 >actual &&
893 test_cmp actual expected
896 test_expect_success SETUP 'un+annihilated t/branch2+1 in outdated t/holdboth' '
897 cd ann &&
898 case "$test_hash_algo" in
899 sha1)
900 cat <<-EOT >expected
901 -----BEGIN TOPGIT REFS-----
902 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
903 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
904 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
905 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
906 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/top-bases/t/branch1
907 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/top-bases/t/branch2
908 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/top-bases/t/holdboth
909 -----END TOPGIT REFS-----
912 sha256)
913 cat <<-EOT >expected
914 -----BEGIN TOPGIT REFS-----
915 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
916 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
917 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
918 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
919 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/top-bases/t/branch1
920 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/top-bases/t/branch2
921 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/top-bases/t/holdboth
922 -----END TOPGIT REFS-----
924 ;;*) die unknown hash "$test_hash_algo"
925 esac &&
926 test_must_fail tg tag --refs t/holdboth &&
927 tg tag --allow-outdated --refs t/holdboth >actual &&
928 test_cmp actual expected
931 test_expect_success SETUP 'unannihilated nontgish base1 base2' '
932 cd ann &&
933 case "$test_hash_algo" in
934 sha1)
935 cat <<-EOT >expected
936 -----BEGIN TOPGIT REFS-----
937 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/heads/base1
938 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
939 -----END TOPGIT REFS-----
942 sha256)
943 cat <<-EOT >expected
944 -----BEGIN TOPGIT REFS-----
945 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/heads/base1
946 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
947 -----END TOPGIT REFS-----
949 ;;*) die unknown hash "$test_hash_algo"
950 esac &&
951 test_must_fail tg tag --refs base1 base2 &&
952 tg tag --allow-any --refs base1 base2 >actual &&
953 test_cmp actual expected
956 test_expect_success SETUP 'signed tags only under refs/tags' '
957 cd ann &&
958 test_must_fail tg tag --no-edit --sign refs/t/branch2 t/branch2 &&
959 test_must_fail tg tag --no-edit --sign refs/remotes/foo t/branch2 &&
960 test_must_fail tg tag --no-edit --sign refs/heads/blahblah t/branch2 &&
961 test_must_fail tg tag --no-edit --sign refs/tgstash t/branch2 &&
962 test_must_fail tg tag --no-edit --sign --stash t/branch2 &&
963 test_must_fail tg tag --no-edit --sign --anonymous t/branch2
966 test_expect_success 'SETUP GPG' 'sign --all' '
967 cd ann &&
968 tggpg tag --no-edit --sign t/signall --all &&
969 git tag --verify t/signall
972 test_expect_success 'SETUP GPG' 'sign holdboth' '
973 cd ann &&
974 test_must_fail tg tag --no-edit --sign t/signboth t/holdboth &&
975 tggpg tag --no-edit --sign --allow-outdated t/signboth t/holdboth &&
976 git tag --verify t/signboth
979 test_done