3 test_description
='test tg tag creation'
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" &&
16 test -d "$GNUPGHOME" &&
17 chmod go-rwx
"$GNUPGHOME" &&
19 { ! command -v gpgconf
>/dev
/null
2>&1 || gpgconf
--kill gpg-agent
>/dev
/null
2>&1 ||
:; } || die
21 gpgscript
="$PWD/gpg-sign.sh"
23 git
-c gpg.program
="$gpgscript" "$@"
26 tg
-c gpg.program
="$gpgscript" "$@"
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.]*}" &&
38 gpg --import "$TEST_DIRECTORY/$this_test/framework-key.gpg"
42 gpg --batch --passphrase "framework" --import "$TEST_DIRECTORY/$this_test/framework-key.gpg"
45 gpg --import-ownertrust "$TEST_DIRECTORY/$this_test/framework-key.trust" &&
46 write_script "$gpgscript" <<-\EOT &&
47 exec gpg --batch --passphrase "framework" "$@"
49 test_create_repo gpg-repo &&
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'
61 test_expect_success
!GPG
'gpg tests disabled' ': # gpg not available'
64 test_expect_success
'setup' '
65 tg_test_v_getbases topbases &&
66 test_create_repo empty &&
67 test_create_repo tgonly &&
68 test_create_repo nontg &&
69 test_create_repo both &&
70 test_create_repo outdated &&
71 test_create_repo ann &&
75 git read-tree --empty &&
76 git symbolic-ref HEAD refs/heads/other &&
80 tg_test_create_branch t/branch1 : &&
81 git checkout -f t/branch1 &&
84 tg_test_create_branch t/branch2 : &&
85 git checkout -f t/branch2 &&
91 git read-tree --empty &&
92 git symbolic-ref HEAD refs/heads/other &&
95 git read-tree --empty &&
96 git symbolic-ref HEAD "$topbases/t/orphanbase" &&
97 test_commit tgorphanbase &&
98 git read-tree --empty &&
99 git symbolic-ref HEAD refs/heads/tgbranch1 &&
100 test_commit tgbefore1 &&
101 tg_test_create_branch t/both1 tgbranch1 &&
102 git checkout -f t/both1 &&
104 git read-tree --empty &&
105 git symbolic-ref HEAD refs/heads/tgbranch2 &&
106 test_commit tgbefore2 &&
107 tg_test_create_branch t/both2 tgbranch2 &&
108 git checkout -f t/both2 &&
112 tg_test_create_branch t/branch master &&
113 test_commit second &&
115 git read-tree --empty &&
116 git symbolic-ref HEAD refs/heads/base1 &&
118 git read-tree --empty &&
119 git symbolic-ref HEAD refs/heads/base2 &&
121 tg_test_create_branch t/branch1 base1 &&
122 git checkout -f t/branch1 &&
123 test_commit branch1 &&
124 anc="$(git commit-tree -m "annihilate" -p HEAD "$(git rev-parse --verify "$topbases/t/branch1^{tree}" --)")" &&
126 git update-ref -m "annihilate branch" HEAD "$anc" HEAD &&
127 tg_test_create_branch t/hold1 t/branch1 &&
128 tg_test_create_branch t/branch2 base2 &&
129 git checkout -f t/branch2 &&
130 test_commit branch2 &&
131 tg_test_create_branch t/hold2 t/branch2 &&
132 tg_test_create_branch t/holdboth t/branch1 t/branch2 &&
133 test_when_finished test_set_prereq SETUP
136 test_expect_success SETUP
'empty fails' '
138 test_must_fail tg tag --refs &&
139 test_must_fail tg tag --refs --all &&
140 test_must_fail tg tag --stash &&
141 test_must_fail tg tag --stash --all &&
142 test_must_fail tg tag --anonymous &&
143 test_must_fail tg tag --anonymous --all &&
144 test_must_fail tg tag foo &&
145 test_must_fail tg tag foo --all
148 test_expect_success SETUP
'empty --allow-any fails' '
150 test_must_fail tg tag --allow-any --refs &&
151 test_must_fail tg tag --allow-any --refs --all &&
152 test_must_fail tg tag --allow-any --stash &&
153 test_must_fail tg tag --allow-any --stash --all &&
154 test_must_fail tg tag --allow-any --anonymous &&
155 test_must_fail tg tag --allow-any --anonymous --all &&
156 test_must_fail tg tag --allow-any foo &&
157 test_must_fail tg tag --allow-any foo --all
160 test_expect_success SETUP
'empty --none-ok fails' '
162 test_must_fail tg tag --none-ok --refs &&
163 test_must_fail tg tag --none-ok --refs --all &&
164 test_must_fail tg tag --none-ok --stash &&
165 test_must_fail tg tag --none-ok --stash --all &&
166 tg tag --none-ok --anonymous && # --anonymous implies --quiet
167 tg tag --none-ok --anonymous --all && # --anonymous implies --quiet
168 test_must_fail tg tag --none-ok foo &&
169 test_must_fail tg tag --none-ok foo --all
172 test_expect_success SETUP
'empty --none-ok --quiet succeeds' '
174 test_must_fail tg tag --none-ok --quiet --refs && # bad HEAD
175 tg tag --none-ok --quiet --refs --all &&
176 tg tag --none-ok --quiet --stash &&
177 tg tag --none-ok --quiet --stash --all &&
178 tg tag --none-ok --quiet --anonymous &&
179 tg tag --none-ok --quiet --anonymous --all &&
180 test_must_fail tg tag --none-ok --quiet foo && # bad HEAD
181 tg tag --none-ok --quiet foo --all
184 test_expect_success SETUP
'empty --none-ok --quiet --quiet succeeds' '
186 test_must_fail tg tag --none-ok --quiet --quiet --refs && # bad HEAD
187 tg tag --none-ok --quiet --quiet --refs --all &&
188 tg tag --none-ok --quiet --quiet --stash &&
189 tg tag --none-ok --quiet --quiet --stash --all &&
190 tg tag --none-ok --quiet --quiet --anonymous &&
191 tg tag --none-ok --quiet --quiet --anonymous --all &&
192 test_must_fail tg tag --none-ok --quiet --quiet foo && # bad HEAD
193 tg tag --none-ok --quiet foo --all
196 test_expect_success SETUP
'nontg fails' '
198 test_must_fail tg tag --refs &&
199 test_must_fail tg tag --refs --all &&
200 test_must_fail tg tag --stash &&
201 test_must_fail tg tag --stash --all &&
202 test_must_fail tg tag --anonymous &&
203 test_must_fail tg tag --anonymous --all &&
204 test_must_fail tg tag foo &&
205 test_must_fail tg tag foo --all
208 test_expect_success SETUP
'nontg --allow-any succeeds' '
210 tg tag --allow-any --refs &&
211 tg tag --allow-any --refs --all &&
212 tg tag --allow-any --stash &&
213 tg tag --allow-any --stash --all &&
214 tg tag --allow-any --anonymous &&
215 tg tag --allow-any --anonymous --all &&
216 tg tag --allow-any foonon-1 &&
217 tg tag --allow-any foonon-2 --all
220 test_expect_success SETUP
'tgonly succeeds' '
223 tg tag --refs --all &&
225 tg tag --stash --all &&
226 tg tag --anonymous &&
227 tg tag --anonymous --all &&
229 tg tag fooonly-2 --all
232 test_expect_success SETUP
'both succeeds' '
235 tg tag --refs --all &&
237 tg tag --stash --all &&
238 tg tag --anonymous &&
239 tg tag --anonymous --all &&
241 tg tag fooboth-2 --all
244 test_expect_success SETUP
'non-stash outdated needs --allow-outdated' '
246 test_must_fail tg tag --refs t/branch &&
247 test_must_fail tg tag sometag t/branch &&
248 tg tag --allow-outdated --refs t/branch >/dev/null &&
249 tg tag --allow-outdated sometag t/branch
252 test_expect_success SETUP
'--stash allows outdated' '
254 tg tag --stash t/branch &&
255 tg tag --anonymous t/branch
258 test_expect_success SETUP
'--stash --all allows outdated' '
261 tg tag --stash t/branch &&
262 tg tag --anonymous &&
263 tg tag --anonymous t/branch
266 test_expect_success SETUP
'non-stash --all allows outdated' '
268 tg tag --refs --all &&
272 test_expect_success SETUP
'replace requires -f' '
274 test_must_fail git rev-parse --verify --quiet replaceme -- >/dev/null &&
276 git rev-parse --verify --quiet replaceme -- >/dev/null &&
277 test_must_fail tg tag replaceme &&
278 tg tag -f replaceme &&
279 git rev-parse --verify --quiet replaceme -- >/dev/null
282 test_expect_success SETUP
'HEAD --refs' '
284 tg_test_v_getbases topbases &&
285 case "$test_hash_algo" in
288 -----BEGIN TOPGIT REFS-----
289 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
290 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
291 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
292 -----END TOPGIT REFS-----
297 -----BEGIN TOPGIT REFS-----
298 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
299 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
300 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
301 -----END TOPGIT REFS-----
303 ;;*) die unknown hash "$test_hash_algo"
305 tg tag --refs >actual &&
306 test_cmp actual expected &&
307 tg tag --refs HEAD >actual &&
308 test_cmp actual expected &&
309 tg tag --refs @ >actual &&
310 test_cmp actual expected &&
311 tg tag --refs @ HEAD >actual &&
312 test_cmp actual expected &&
313 tg tag --refs HEAD @ >actual &&
314 test_cmp actual expected &&
315 tg tag --refs HEAD HEAD >actual &&
316 test_cmp actual expected &&
317 tg tag --refs @ @ >actual &&
318 test_cmp actual expected
321 test_expect_success SETUP
't/both2 --refs' '
323 tg_test_v_getbases topbases &&
324 case "$test_hash_algo" in
327 -----BEGIN TOPGIT REFS-----
328 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
329 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
330 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
331 -----END TOPGIT REFS-----
336 -----BEGIN TOPGIT REFS-----
337 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
338 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
339 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
340 -----END TOPGIT REFS-----
342 ;;*) die unknown hash "$test_hash_algo"
344 tg tag --refs t/both2 >actual &&
345 test_cmp actual expected &&
346 tg tag --refs t/both2 t/both2 >actual &&
347 test_cmp actual expected
350 test_expect_success SETUP
't/both1 --refs' '
352 tg_test_v_getbases topbases &&
353 case "$test_hash_algo" in
356 -----BEGIN TOPGIT REFS-----
357 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
358 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
359 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
360 -----END TOPGIT REFS-----
365 -----BEGIN TOPGIT REFS-----
366 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
367 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
368 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
369 -----END TOPGIT REFS-----
371 ;;*) die unknown hash "$test_hash_algo"
373 tg tag --refs t/both1 >actual &&
374 test_cmp actual expected &&
375 tg tag --refs t/both1 t/both1 >actual &&
376 test_cmp actual expected
379 test_expect_success SETUP
't/orphanbase --refs' '
381 tg_test_v_getbases topbases &&
382 case "$test_hash_algo" in
385 -----BEGIN TOPGIT REFS-----
386 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
387 -----END TOPGIT REFS-----
392 -----BEGIN TOPGIT REFS-----
393 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
394 -----END TOPGIT REFS-----
396 ;;*) die unknown hash "$test_hash_algo"
398 test_must_fail tg tag --refs t/orphanbase &&
399 test_must_fail tg tag --refs refs/heads/t/orphanbase &&
400 tg tag --refs "$topbases"/t/orphanbase >actual &&
401 test_cmp actual expected
404 test_expect_success SETUP
't/both1 t/both2 --refs' '
406 tg_test_v_getbases topbases &&
407 case "$test_hash_algo" in
410 -----BEGIN TOPGIT REFS-----
411 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
412 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
413 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
414 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
415 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
416 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
417 -----END TOPGIT REFS-----
422 -----BEGIN TOPGIT REFS-----
423 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
424 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
425 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
426 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
427 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
428 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
429 -----END TOPGIT REFS-----
431 ;;*) die unknown hash "$test_hash_algo"
433 tg tag --refs t/both1 t/both2 >actual &&
434 test_cmp actual expected &&
435 tg tag --refs t/both2 t/both1 >actual &&
436 test_cmp actual expected
439 test_expect_success SETUP
't/both1 {base}t/orphanbase --refs' '
441 tg_test_v_getbases topbases &&
442 case "$test_hash_algo" in
445 -----BEGIN TOPGIT REFS-----
446 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
447 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
448 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
449 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
450 -----END TOPGIT REFS-----
455 -----BEGIN TOPGIT REFS-----
456 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
457 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
458 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
459 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
460 -----END TOPGIT REFS-----
462 ;;*) die unknown hash "$test_hash_algo"
464 tg tag --refs t/both1 "$topbases/t/orphanbase" >actual &&
465 test_cmp actual expected &&
466 tg tag --refs "$topbases/t/orphanbase" t/both1 >actual &&
467 test_cmp actual expected
470 test_expect_success SETUP
't/both1 {base}t/orphanbase t/both2 --refs' '
472 tg_test_v_getbases topbases &&
473 case "$test_hash_algo" in
476 -----BEGIN TOPGIT REFS-----
477 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
478 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
479 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
480 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
481 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
482 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
483 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
484 -----END TOPGIT REFS-----
489 -----BEGIN TOPGIT REFS-----
490 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
491 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
492 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
493 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
494 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
495 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
496 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
497 -----END TOPGIT REFS-----
499 ;;*) die unknown hash "$test_hash_algo"
501 tg tag --refs t/both1 "$topbases/t/orphanbase" t/both2 >actual &&
502 test_cmp actual expected &&
503 tg tag --refs "$topbases/t/orphanbase" t/both1 t/both2 >actual &&
504 test_cmp actual expected &&
505 tg tag --refs t/both2 t/both1 "$topbases/t/orphanbase" >actual &&
506 test_cmp actual expected
509 test_expect_success SETUP
'explicit non-tgish fails --refs' '
511 test_must_fail tg tag --refs master &&
512 test_must_fail tg tag --refs other &&
513 test_must_fail tg tag --refs refs/heads/master &&
514 test_must_fail tg tag --refs refs/heads/other &&
515 test_must_fail tg tag --refs master other &&
516 test_must_fail tg tag --refs other master &&
517 test_must_fail tg tag --refs other refs/heads/master &&
518 test_must_fail tg tag --refs refs/heads/other master
521 test_expect_success SETUP
'explicit non-tgish succeeds --allow-any --refs' '
523 case "$test_hash_algo" in
526 -----BEGIN TOPGIT REFS-----
527 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
528 -----END TOPGIT REFS-----
533 -----BEGIN TOPGIT REFS-----
534 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
535 -----END TOPGIT REFS-----
537 ;;*) die unknown hash "$test_hash_algo"
539 tg tag --allow-any --refs master >actual &&
540 test_cmp actual expected &&
541 tg tag --allow-any --refs refs/heads/master >actual &&
542 test_cmp actual expected &&
543 case "$test_hash_algo" in
546 -----BEGIN TOPGIT REFS-----
547 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
548 -----END TOPGIT REFS-----
553 -----BEGIN TOPGIT REFS-----
554 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
555 -----END TOPGIT REFS-----
557 ;;*) die unknown hash "$test_hash_algo"
559 tg tag --allow-any --refs other >actual &&
560 test_cmp actual expected &&
561 tg tag --allow-any --refs refs/heads/other >actual &&
562 test_cmp actual expected &&
563 case "$test_hash_algo" in
566 -----BEGIN TOPGIT REFS-----
567 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
568 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
569 -----END TOPGIT REFS-----
574 -----BEGIN TOPGIT REFS-----
575 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
576 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
577 -----END TOPGIT REFS-----
579 ;;*) die unknown hash "$test_hash_algo"
581 tg tag --allow-any --refs master other >actual &&
582 test_cmp actual expected &&
583 tg tag --allow-any --refs other master >actual &&
584 test_cmp actual expected &&
585 tg tag --allow-any --refs other refs/heads/master >actual &&
586 test_cmp actual expected &&
587 tg tag --allow-any --refs refs/heads/other master >actual &&
588 test_cmp actual expected
591 test_expect_success SETUP
't/both1 master --refs needs --allow-any' '
593 tg_test_v_getbases topbases &&
594 case "$test_hash_algo" in
597 -----BEGIN TOPGIT REFS-----
598 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
599 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
600 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
601 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
602 -----END TOPGIT REFS-----
607 -----BEGIN TOPGIT REFS-----
608 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
609 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
610 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
611 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
612 -----END TOPGIT REFS-----
614 ;;*) die unknown hash "$test_hash_algo"
616 test_must_fail tg tag --refs t/both1 master &&
617 test_must_fail tg tag --refs master t/both1 &&
618 tg tag --allow-any --refs t/both1 master >actual &&
619 test_cmp actual expected &&
620 tg tag --allow-any --refs master t/both1 >actual &&
621 test_cmp actual expected
624 test_expect_success SETUP
'--all refs impliclt and explicit' '
626 tg_test_v_getbases topbases &&
627 case "$test_hash_algo" in
630 -----BEGIN TOPGIT REFS-----
631 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
632 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
633 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
634 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
635 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
636 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
637 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
638 -----END TOPGIT REFS-----
643 -----BEGIN TOPGIT REFS-----
644 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
645 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
646 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
647 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
648 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
649 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
650 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
651 -----END TOPGIT REFS-----
653 ;;*) die unknown hash "$test_hash_algo"
655 tg tag --all --refs >actual &&
656 test_cmp actual expected &&
657 tg tag --refs --all >actual &&
658 test_cmp actual expected &&
659 tg tag --refs t/both1 t/both2 "$topbases/t/orphanbase" >actual &&
660 test_cmp actual expected
663 test_expect_success SETUP
'--allow-any --all refs impliclt and explicit' '
665 tg_test_v_getbases topbases &&
666 case "$test_hash_algo" in
669 -----BEGIN TOPGIT REFS-----
670 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
671 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
672 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
673 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
674 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
675 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
676 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
677 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
678 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
679 -----END TOPGIT REFS-----
684 -----BEGIN TOPGIT REFS-----
685 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
686 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
687 c11f8c3afe367bf8a31e8468a7b2a2d090ecb80b43d0bad0624c3dc880ca1cd6 refs/heads/t/both1
688 ee0d6b825ea2487e97649b5ef657b47ab9e4613985500d032c4efad6c470d450 refs/heads/t/both2
689 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 refs/heads/tgbranch1
690 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 refs/heads/tgbranch2
691 a75196643f7fc0adf54d254560c9f1ded5b883ba6a5f278dfc7ef54c7d47b3c6 $topbases/t/both1
692 33d222cffd3df8e1c841b28c59d3f743bee5ae2e684c7b85a99d09e41a2c8216 $topbases/t/both2
693 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
694 -----END TOPGIT REFS-----
696 ;;*) die unknown hash "$test_hash_algo"
698 tg tag --all --refs >actual &&
699 test_must_fail test_cmp actual expected &&
700 tg tag --refs --all >actual &&
701 test_must_fail test_cmp actual expected &&
702 tg tag --refs t/both1 t/both2 "$topbases/t/orphanbase" >actual &&
703 test_must_fail test_cmp actual expected &&
704 tg tag --allow-any --all --refs >actual &&
705 test_cmp actual expected &&
706 tg tag --allow-any --refs --all >actual &&
707 test_cmp actual expected &&
708 test_must_fail tg tag --refs master other t/both1 t/both2 "$topbases/t/orphanbase" &&
709 tg tag --allow-any --refs master other t/both1 t/both2 "$topbases/t/orphanbase" >actual &&
710 test_cmp actual expected
713 test_expect_success SETUP
'annihilated --all' '
715 tg_test_v_getbases topbases &&
716 case "$test_hash_algo" in
719 -----BEGIN TOPGIT REFS-----
720 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
721 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
722 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
723 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
724 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
725 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
726 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
727 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
728 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/hold1
729 e6f05ae1f7586c2efc3816a2e6c806e109c9026a $topbases/t/hold2
730 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/holdboth
731 -----END TOPGIT REFS-----
736 -----BEGIN TOPGIT REFS-----
737 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
738 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
739 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
740 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
741 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
742 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
743 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c $topbases/t/branch1
744 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 $topbases/t/branch2
745 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/hold1
746 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 $topbases/t/hold2
747 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/holdboth
748 -----END TOPGIT REFS-----
750 ;;*) die unknown hash "$test_hash_algo"
752 tg tag --refs --all >actual &&
753 test_cmp actual expected
756 test_expect_success SETUP
'annihilated --allow-any --all' '
758 tg_test_v_getbases topbases &&
759 case "$test_hash_algo" in
762 -----BEGIN TOPGIT REFS-----
763 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/heads/base1
764 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
765 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
766 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
767 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
768 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
769 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
770 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
771 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
772 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/hold1
773 e6f05ae1f7586c2efc3816a2e6c806e109c9026a $topbases/t/hold2
774 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/holdboth
775 -----END TOPGIT REFS-----
780 -----BEGIN TOPGIT REFS-----
781 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/heads/base1
782 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
783 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
784 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
785 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
786 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
787 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
788 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c $topbases/t/branch1
789 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 $topbases/t/branch2
790 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/hold1
791 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 $topbases/t/hold2
792 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/holdboth
793 -----END TOPGIT REFS-----
795 ;;*) die unknown hash "$test_hash_algo"
797 tg tag --allow-any --refs --all >actual &&
798 test_cmp actual expected
801 test_expect_success SETUP
'annihilated t/branch1' '
803 tg_test_v_getbases topbases &&
804 case "$test_hash_algo" in
807 -----BEGIN TOPGIT REFS-----
808 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
809 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
810 -----END TOPGIT REFS-----
815 -----BEGIN TOPGIT REFS-----
816 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
817 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c $topbases/t/branch1
818 -----END TOPGIT REFS-----
820 ;;*) die unknown hash "$test_hash_algo"
822 tg tag --refs t/branch1 >actual &&
823 test_cmp actual expected
826 test_expect_success SETUP
'unannihilated t/branch2' '
828 tg_test_v_getbases topbases &&
829 case "$test_hash_algo" in
832 -----BEGIN TOPGIT REFS-----
833 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
834 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
835 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
836 -----END TOPGIT REFS-----
841 -----BEGIN TOPGIT REFS-----
842 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
843 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
844 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 $topbases/t/branch2
845 -----END TOPGIT REFS-----
847 ;;*) die unknown hash "$test_hash_algo"
849 tg tag --refs t/branch2 >actual &&
850 test_cmp actual expected
853 test_expect_success SETUP
'annihilated t/branch1 in t/hold1' '
855 tg_test_v_getbases topbases &&
856 case "$test_hash_algo" in
859 -----BEGIN TOPGIT REFS-----
860 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
861 bed0691bb40fbc621864b3d522ae905c77962f72 refs/heads/t/hold1
862 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
863 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/hold1
864 -----END TOPGIT REFS-----
869 -----BEGIN TOPGIT REFS-----
870 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
871 0931c2e5c8a3bc40713087fd82b9ee1bd4dbb7ec3dc3c204a777f17f93bda214 refs/heads/t/hold1
872 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c $topbases/t/branch1
873 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/hold1
874 -----END TOPGIT REFS-----
876 ;;*) die unknown hash "$test_hash_algo"
878 tg tag --refs t/hold1 >actual &&
879 test_cmp actual expected
882 test_expect_success SETUP
'unannihilated t/branch2 in t/hold2' '
884 tg_test_v_getbases topbases &&
885 case "$test_hash_algo" in
888 -----BEGIN TOPGIT REFS-----
889 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
890 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
891 569495b4c2ad34234744f48f0f9ae14a2350313d refs/heads/t/hold2
892 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
893 e6f05ae1f7586c2efc3816a2e6c806e109c9026a $topbases/t/hold2
894 -----END TOPGIT REFS-----
899 -----BEGIN TOPGIT REFS-----
900 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
901 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
902 4c1cf35b0e6865e2f7873e9808ba4b3aa106f457af150df9b61354b159a04628 refs/heads/t/hold2
903 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 $topbases/t/branch2
904 0cdfb48970ce82cdb43e3b02dedd3abe429b6ddd14f28630c6ff6bd4cce299d3 $topbases/t/hold2
905 -----END TOPGIT REFS-----
907 ;;*) die unknown hash "$test_hash_algo"
909 tg tag --refs t/hold2 >actual &&
910 test_cmp actual expected
913 test_expect_success SETUP
'un+annihilated t/branch2+1 in outdated t/holdboth' '
915 tg_test_v_getbases topbases &&
916 case "$test_hash_algo" in
919 -----BEGIN TOPGIT REFS-----
920 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
921 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
922 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
923 3efadbea0c9156b1cf2ae484bc78d7a0ce7bdbcb refs/heads/t/holdboth
924 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
925 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
926 fcc5e64345ed3758678342fc04bfa0aa803d8897 $topbases/t/holdboth
927 -----END TOPGIT REFS-----
932 -----BEGIN TOPGIT REFS-----
933 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
934 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 refs/heads/t/branch1
935 2c4622205d15e337a93a6f932a80b7ebfae0f9365a264c63505dc93eb4cdd71b refs/heads/t/branch2
936 abbde2d54d953df9b98baf88efd25aaca6ca2d3633daada86f78412484ac5990 refs/heads/t/holdboth
937 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c $topbases/t/branch1
938 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 $topbases/t/branch2
939 438fd0d110f4b7520100d6692a8fd0382dc9abcdb2e2c3886d0d9e1673b30e59 $topbases/t/holdboth
940 -----END TOPGIT REFS-----
942 ;;*) die unknown hash "$test_hash_algo"
944 test_must_fail tg tag --refs t/holdboth &&
945 tg tag --allow-outdated --refs t/holdboth >actual &&
946 test_cmp actual expected
949 test_expect_success SETUP
'unannihilated nontgish base1 base2' '
951 case "$test_hash_algo" in
954 -----BEGIN TOPGIT REFS-----
955 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/heads/base1
956 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
957 -----END TOPGIT REFS-----
962 -----BEGIN TOPGIT REFS-----
963 e20a1a20f76f65f42ea0013a3d629069ef0ab7bcffa22268182d096c39b7e91c refs/heads/base1
964 4998b9dec22cbeda84e886bcc3fd723eda9c893883cd242b961fe5d7beb16cb8 refs/heads/base2
965 -----END TOPGIT REFS-----
967 ;;*) die unknown hash "$test_hash_algo"
969 test_must_fail tg tag --refs base1 base2 &&
970 tg tag --allow-any --refs base1 base2 >actual &&
971 test_cmp actual expected
974 test_expect_success SETUP
'signed tags only under refs/tags' '
976 test_must_fail tg tag --no-edit --sign refs/t/branch2 t/branch2 &&
977 test_must_fail tg tag --no-edit --sign refs/remotes/foo t/branch2 &&
978 test_must_fail tg tag --no-edit --sign refs/heads/blahblah t/branch2 &&
979 test_must_fail tg tag --no-edit --sign refs/tgstash t/branch2 &&
980 test_must_fail tg tag --no-edit --sign --stash t/branch2 &&
981 test_must_fail tg tag --no-edit --sign --anonymous t/branch2
984 test_expect_success
'SETUP GPG' 'sign --all' '
986 tggpg tag --no-edit --sign t/signall --all &&
987 git tag --verify t/signall
990 test_expect_success
'SETUP GPG' 'sign holdboth' '
992 test_must_fail tg tag --no-edit --sign t/signboth t/holdboth &&
993 tggpg tag --no-edit --sign --allow-outdated t/signboth t/holdboth &&
994 git tag --verify t/signboth