tg.sh: handle help -h
[topgit/pro.git] / t / t6120-tag-stash.sh
blob1bf14e2642fa47d687a362bc1d70b37e8cfbd1e6
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 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 &&
72 cd nontg &&
73 test_commit one &&
74 test_commit two &&
75 git read-tree --empty &&
76 git symbolic-ref HEAD refs/heads/other &&
77 test_commit o1 &&
78 test_commit o2 &&
79 cd ../tgonly &&
80 tg_test_create_branch t/branch1 : &&
81 git checkout -f t/branch1 &&
82 test_commit tgb1a &&
83 test_commit tgb1b &&
84 tg_test_create_branch t/branch2 : &&
85 git checkout -f t/branch2 &&
86 test_commit tgb2a &&
87 test_commit tgb2b &&
88 cd ../both &&
89 test_commit m1 &&
90 test_commit m2 &&
91 git read-tree --empty &&
92 git symbolic-ref HEAD refs/heads/other &&
93 test_commit o1 &&
94 test_commit o2 &&
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 &&
103 test_commit 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 &&
109 test_commit both2 &&
110 cd ../outdated &&
111 test_commit first &&
112 tg_test_create_branch t/branch master &&
113 test_commit second &&
114 cd ../ann &&
115 git read-tree --empty &&
116 git symbolic-ref HEAD refs/heads/base1 &&
117 test_commit base1 &&
118 git read-tree --empty &&
119 git symbolic-ref HEAD refs/heads/base2 &&
120 test_commit 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}" --)")" &&
125 test -n "$anc" &&
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' '
137 cd empty &&
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' '
149 cd empty &&
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' '
161 cd empty &&
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' '
173 cd empty &&
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' '
185 cd empty &&
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' '
197 cd nontg &&
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' '
209 cd nontg &&
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' '
221 cd tgonly &&
222 tg tag --refs &&
223 tg tag --refs --all &&
224 tg tag --stash &&
225 tg tag --stash --all &&
226 tg tag --anonymous &&
227 tg tag --anonymous --all &&
228 tg tag fooonly-1 &&
229 tg tag fooonly-2 --all
232 test_expect_success SETUP 'both succeeds' '
233 cd both &&
234 tg tag --refs &&
235 tg tag --refs --all &&
236 tg tag --stash &&
237 tg tag --stash --all &&
238 tg tag --anonymous &&
239 tg tag --anonymous --all &&
240 tg tag fooboth-1 &&
241 tg tag fooboth-2 --all
244 test_expect_success SETUP 'non-stash outdated needs --allow-outdated' '
245 cd 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' '
253 cd outdated &&
254 tg tag --stash t/branch &&
255 tg tag --anonymous t/branch
258 test_expect_success SETUP '--stash --all allows outdated' '
259 cd outdated &&
260 tg tag --stash &&
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' '
267 cd outdated &&
268 tg tag --refs --all &&
269 tg tag alltag --all
272 test_expect_success SETUP 'replace requires -f' '
273 cd both &&
274 test_must_fail git rev-parse --verify --quiet replaceme -- >/dev/null &&
275 tg tag replaceme &&
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' '
283 cd both &&
284 tg_test_v_getbases topbases &&
285 case "$test_hash_algo" in
286 sha1)
287 cat <<-EOT >expected
288 -----BEGIN TOPGIT REFS-----
289 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
290 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
291 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
292 -----END TOPGIT REFS-----
295 sha256)
296 cat <<-EOT >expected
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"
304 esac &&
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' '
322 cd both &&
323 tg_test_v_getbases topbases &&
324 case "$test_hash_algo" in
325 sha1)
326 cat <<-EOT >expected
327 -----BEGIN TOPGIT REFS-----
328 56035f3acec7b94aa0d7c38efbf978c16711920c refs/heads/t/both2
329 b468326bcc77566ad05a8ecdb613b0fc737472cf refs/heads/tgbranch2
330 b468326bcc77566ad05a8ecdb613b0fc737472cf $topbases/t/both2
331 -----END TOPGIT REFS-----
334 sha256)
335 cat <<-EOT >expected
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"
343 esac &&
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' '
351 cd both &&
352 tg_test_v_getbases topbases &&
353 case "$test_hash_algo" in
354 sha1)
355 cat <<-EOT >expected
356 -----BEGIN TOPGIT REFS-----
357 4c9786c5edd2095cad2226d787462fd2b9f28eac refs/heads/t/both1
358 1f2e77bea71b03b41209b5233dda7458d7528ef1 refs/heads/tgbranch1
359 1f2e77bea71b03b41209b5233dda7458d7528ef1 $topbases/t/both1
360 -----END TOPGIT REFS-----
363 sha256)
364 cat <<-EOT >expected
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"
372 esac &&
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' '
380 cd both &&
381 tg_test_v_getbases topbases &&
382 case "$test_hash_algo" in
383 sha1)
384 cat <<-EOT >expected
385 -----BEGIN TOPGIT REFS-----
386 8b5716e97e03bafa97f7a5e7e0e155305dccac02 $topbases/t/orphanbase
387 -----END TOPGIT REFS-----
390 sha256)
391 cat <<-EOT >expected
392 -----BEGIN TOPGIT REFS-----
393 3a584f2c67214be83735f6e3a68b130eebff39badcb63771d6dd64b61e438914 $topbases/t/orphanbase
394 -----END TOPGIT REFS-----
396 ;;*) die unknown hash "$test_hash_algo"
397 esac &&
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' '
405 cd both &&
406 tg_test_v_getbases topbases &&
407 case "$test_hash_algo" in
408 sha1)
409 cat <<-EOT >expected
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-----
420 sha256)
421 cat <<-EOT >expected
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"
432 esac &&
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' '
440 cd both &&
441 tg_test_v_getbases topbases &&
442 case "$test_hash_algo" in
443 sha1)
444 cat <<-EOT >expected
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-----
453 sha256)
454 cat <<-EOT >expected
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"
463 esac &&
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' '
471 cd both &&
472 tg_test_v_getbases topbases &&
473 case "$test_hash_algo" in
474 sha1)
475 cat <<-EOT >expected
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-----
487 sha256)
488 cat <<-EOT >expected
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"
500 esac &&
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' '
510 cd both &&
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' '
522 cd both &&
523 case "$test_hash_algo" in
524 sha1)
525 cat <<-EOT >expected
526 -----BEGIN TOPGIT REFS-----
527 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
528 -----END TOPGIT REFS-----
531 sha256)
532 cat <<-EOT >expected
533 -----BEGIN TOPGIT REFS-----
534 dc86d738487642a9f82ebf5e67bf627d9d643ee296844cffea9145f9a8419196 refs/heads/master
535 -----END TOPGIT REFS-----
537 ;;*) die unknown hash "$test_hash_algo"
538 esac &&
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
544 sha1)
545 cat <<-EOT >expected
546 -----BEGIN TOPGIT REFS-----
547 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
548 -----END TOPGIT REFS-----
551 sha256)
552 cat <<-EOT >expected
553 -----BEGIN TOPGIT REFS-----
554 c3e5c7e000d22047666dc24a9f64ba5e38c70b013b7dfcf1b40ef10c4c8fac12 refs/heads/other
555 -----END TOPGIT REFS-----
557 ;;*) die unknown hash "$test_hash_algo"
558 esac &&
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
564 sha1)
565 cat <<-EOT >expected
566 -----BEGIN TOPGIT REFS-----
567 24863d9c5498b120622ba4b67b5de2a5c9b67a94 refs/heads/master
568 516124ddbb5f9e2c33be37a1d6f3f2c4b0c23dd2 refs/heads/other
569 -----END TOPGIT REFS-----
572 sha256)
573 cat <<-EOT >expected
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"
580 esac &&
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' '
592 cd both &&
593 tg_test_v_getbases topbases &&
594 case "$test_hash_algo" in
595 sha1)
596 cat <<-EOT >expected
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-----
605 sha256)
606 cat <<-EOT >expected
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"
615 esac &&
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' '
625 cd both &&
626 tg_test_v_getbases topbases &&
627 case "$test_hash_algo" in
628 sha1)
629 cat <<-EOT >expected
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-----
641 sha256)
642 cat <<-EOT >expected
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"
654 esac &&
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' '
664 cd both &&
665 tg_test_v_getbases topbases &&
666 case "$test_hash_algo" in
667 sha1)
668 cat <<-EOT >expected
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-----
682 sha256)
683 cat <<-EOT >expected
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"
697 esac &&
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' '
714 cd ann &&
715 tg_test_v_getbases topbases &&
716 case "$test_hash_algo" in
717 sha1)
718 cat <<-EOT >expected
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-----
734 sha256)
735 cat <<-EOT >expected
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"
751 esac &&
752 tg tag --refs --all >actual &&
753 test_cmp actual expected
756 test_expect_success SETUP 'annihilated --allow-any --all' '
757 cd ann &&
758 tg_test_v_getbases topbases &&
759 case "$test_hash_algo" in
760 sha1)
761 cat <<-EOT >expected
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-----
778 sha256)
779 cat <<-EOT >expected
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"
796 esac &&
797 tg tag --allow-any --refs --all >actual &&
798 test_cmp actual expected
801 test_expect_success SETUP 'annihilated t/branch1' '
802 cd ann &&
803 tg_test_v_getbases topbases &&
804 case "$test_hash_algo" in
805 sha1)
806 cat <<-EOT >expected
807 -----BEGIN TOPGIT REFS-----
808 fcc5e64345ed3758678342fc04bfa0aa803d8897 refs/heads/t/branch1
809 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 $topbases/t/branch1
810 -----END TOPGIT REFS-----
813 sha256)
814 cat <<-EOT >expected
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"
821 esac &&
822 tg tag --refs t/branch1 >actual &&
823 test_cmp actual expected
826 test_expect_success SETUP 'unannihilated t/branch2' '
827 cd ann &&
828 tg_test_v_getbases topbases &&
829 case "$test_hash_algo" in
830 sha1)
831 cat <<-EOT >expected
832 -----BEGIN TOPGIT REFS-----
833 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
834 067958167cc682564f55865c6056af4a7a71421c refs/heads/t/branch2
835 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb $topbases/t/branch2
836 -----END TOPGIT REFS-----
839 sha256)
840 cat <<-EOT >expected
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"
848 esac &&
849 tg tag --refs t/branch2 >actual &&
850 test_cmp actual expected
853 test_expect_success SETUP 'annihilated t/branch1 in t/hold1' '
854 cd ann &&
855 tg_test_v_getbases topbases &&
856 case "$test_hash_algo" in
857 sha1)
858 cat <<-EOT >expected
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-----
867 sha256)
868 cat <<-EOT >expected
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"
877 esac &&
878 tg tag --refs t/hold1 >actual &&
879 test_cmp actual expected
882 test_expect_success SETUP 'unannihilated t/branch2 in t/hold2' '
883 cd ann &&
884 tg_test_v_getbases topbases &&
885 case "$test_hash_algo" in
886 sha1)
887 cat <<-EOT >expected
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-----
897 sha256)
898 cat <<-EOT >expected
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"
908 esac &&
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' '
914 cd ann &&
915 tg_test_v_getbases topbases &&
916 case "$test_hash_algo" in
917 sha1)
918 cat <<-EOT >expected
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-----
930 sha256)
931 cat <<-EOT >expected
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"
943 esac &&
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' '
950 cd ann &&
951 case "$test_hash_algo" in
952 sha1)
953 cat <<-EOT >expected
954 -----BEGIN TOPGIT REFS-----
955 ebbc158db4c933fbc1b915c5da3aede2e1bfae30 refs/heads/base1
956 46ba22545c6bed4b0a55a2426f2c4f6d1a9617bb refs/heads/base2
957 -----END TOPGIT REFS-----
960 sha256)
961 cat <<-EOT >expected
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"
968 esac &&
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' '
975 cd ann &&
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' '
985 cd ann &&
986 tggpg tag --no-edit --sign t/signall --all &&
987 git tag --verify t/signall
990 test_expect_success 'SETUP GPG' 'sign holdboth' '
991 cd ann &&
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
997 test_done