t7004: do not prepare things outside test_expect_success
Do not prepare expect and other things outside test_expect_success. If such code fails for some reason, we won't necessarily hear about it in a timely fashion (or perhaps at all). By placing all code inside `test_expect_success` it ensures that we know immediately if it fails. Also add '\' before EOF to avoid shell interpolation and '-' to allow indentation of the body. Signed-off-by: AbdAlRahman Gad <abdobngad@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
AbdAlRahman Gad committed
Aug 8, 2024 at 19:32 UTC
c4e00c1c6b08a784813d4a2da969e388245ee1ab
1 file changed
+360
-338
t/t7004-tag.sh
+360
-338
@@ -129,10 +129,10 @@ test_expect_success 'listing all tags if one exists should succeed' '
129
git tag
130
'
131
132
-cat >expect <<EOF
133
-mytag
134
-EOF
132
test_expect_success 'Multiple -l or --list options are equivalent to one -l option' '
133
+ cat >expect <<-\EOF &&
134
+ mytag
135
+ EOF
136
git tag -l -l >actual &&
137
test_cmp expect actual &&
138
git tag --list --list >actual &&
@@ -207,12 +207,12 @@ test_expect_success 'trying to delete an unknown tag should fail' '
207
test_must_fail git tag -d unknown-tag
208
'
209
210
-cat >expect <<EOF
211
-myhead
212
-mytag
213
-EOF
210
test_expect_success \
211
'trying to delete tags without params should succeed and do nothing' '
212
+ cat >expect <<-\EOF &&
213
+ myhead
214
+ mytag
215
+ EOF
216
git tag -l >actual &&
217
test_cmp expect actual &&
218
git tag -d &&
@@ -250,18 +250,18 @@ test_expect_success 'trying to delete an already deleted tag should fail' \
250
251
# listing various tags with pattern matching:
252
253
-cat >expect <<EOF
254
-a1
255
-aa1
256
-cba
257
-t210
258
-t211
259
-v0.2.1
260
-v1.0
261
-v1.0.1
262
-v1.1.3
263
-EOF
253
test_expect_success 'listing all tags should print them ordered' '
254
+ cat >expect <<-\EOF &&
255
+ a1
256
+ aa1
257
+ cba
258
+ t210
259
+ t211
260
+ v0.2.1
261
+ v1.0
262
+ v1.0.1
263
+ v1.1.3
264
+ EOF
265
git tag v1.0.1 &&
266
git tag t211 &&
267
git tag aa1 &&
@@ -277,62 +277,62 @@ test_expect_success 'listing all tags should print them ordered' '
277
test_cmp expect actual
278
'
279
280
-cat >expect <<EOF
281
-a1
282
-aa1
283
-cba
284
-EOF
280
test_expect_success \
281
'listing tags with substring as pattern must print those matching' '
282
+ cat >expect <<-\EOF &&
283
+ a1
284
+ aa1
285
+ cba
286
+ EOF
287
rm *a* &&
288
git tag -l "*a*" >current &&
289
test_cmp expect current
290
'
291
292
-cat >expect <<EOF
293
-v0.2.1
294
-v1.0.1
295
-EOF
292
test_expect_success \
293
'listing tags with a suffix as pattern must print those matching' '
294
+ cat >expect <<-\EOF &&
295
+ v0.2.1
296
+ v1.0.1
297
+ EOF
298
git tag -l "*.1" >actual &&
299
test_cmp expect actual
300
'
301
302
-cat >expect <<EOF
303
-t210
304
-t211
305
-EOF
302
test_expect_success \
303
'listing tags with a prefix as pattern must print those matching' '
304
+ cat >expect <<-\EOF &&
305
+ t210
306
+ t211
307
+ EOF
308
git tag -l "t21*" >actual &&
309
test_cmp expect actual
310
'
311
312
-cat >expect <<EOF
313
-a1
314
-EOF
312
test_expect_success \
313
'listing tags using a name as pattern must print that one matching' '
314
+ cat >expect <<-\EOF &&
315
+ a1
316
+ EOF
317
git tag -l a1 >actual &&
318
test_cmp expect actual
319
'
320
321
-cat >expect <<EOF
322
-v1.0
323
-EOF
321
test_expect_success \
322
'listing tags using a name as pattern must print that one matching' '
323
+ cat >expect <<-\EOF &&
324
+ v1.0
325
+ EOF
326
git tag -l v1.0 >actual &&
327
test_cmp expect actual
328
'
329
330
-cat >expect <<EOF
331
-v1.0.1
332
-v1.1.3
333
-EOF
330
test_expect_success \
331
'listing tags with ? in the pattern should print those matching' '
332
+ cat >expect <<-\EOF &&
333
+ v1.0.1
334
+ v1.1.3
335
+ EOF
336
git tag -l "v1.?.?" >actual &&
337
test_cmp expect actual
338
'
@@ -343,19 +343,25 @@ test_expect_success \
343
test_must_be_empty actual
344
'
345
346
-cat >expect <<EOF
347
-v0.2.1
348
-v1.0
349
-v1.0.1
350
-v1.1.3
351
-EOF
346
test_expect_success \
347
'listing tags using v* should print only those having v' '
348
+ cat >expect <<-\EOF &&
349
+ v0.2.1
350
+ v1.0
351
+ v1.0.1
352
+ v1.1.3
353
+ EOF
354
git tag -l "v*" >actual &&
355
test_cmp expect actual
356
'
357
358
test_expect_success 'tag -l can accept multiple patterns' '
359
+ cat >expect <<-\EOF &&
360
+ v0.2.1
361
+ v1.0
362
+ v1.0.1
363
+ v1.1.3
364
+ EOF
365
git tag -l "v1*" "v0*" >actual &&
366
test_cmp expect actual
367
'
@@ -369,6 +375,12 @@ test_expect_success 'tag -l can accept multiple patterns' '
375
# out if we're going to break this long-documented form of taking
376
# multiple patterns.
377
test_expect_success 'tag -l <pattern> -l <pattern> works, as our buggy documentation previously suggested' '
378
+ cat >expect <<-\EOF &&
379
+ v0.2.1
380
+ v1.0
381
+ v1.0.1
382
+ v1.1.3
383
+ EOF
384
git tag -l "v1*" -l "v0*" >actual &&
385
test_cmp expect actual
386
'
@@ -451,68 +463,69 @@ tagger C O Mitter <committer@example.com> $4 -0700
463
EOF
464
}
465
454
-commit=$(git rev-parse HEAD)
455
-time=$test_tick
456
-
457
-get_tag_header annotated-tag $commit commit $time >expect
458
-echo "A message" >>expect
466
test_expect_success \
467
'creating an annotated tag with -m message should succeed' '
468
+ commit=$(git rev-parse HEAD) &&
469
+ time=$test_tick &&
470
+ get_tag_header annotated-tag $commit commit $time >expect &&
471
+ echo "A message" >>expect &&
472
git tag -m "A message" annotated-tag &&
473
get_tag_msg annotated-tag >actual &&
474
test_cmp expect actual
475
'
476
466
-get_tag_header annotated-tag-edit $commit commit $time >expect
467
-echo "An edited message" >>expect
477
test_expect_success 'set up editor' '
478
write_script fakeeditor <<-\EOF
479
sed -e "s/A message/An edited message/g" <"$1" >"$1-"
480
mv "$1-" "$1"
481
EOF
482
'
483
+
484
test_expect_success \
485
'creating an annotated tag with -m message --edit should succeed' '
486
+ get_tag_header annotated-tag-edit $commit commit $time >expect &&
487
+ echo "An edited message" >>expect &&
488
GIT_EDITOR=./fakeeditor git tag -m "A message" --edit annotated-tag-edit &&
489
get_tag_msg annotated-tag-edit >actual &&
490
test_cmp expect actual
491
'
492
481
-cat >msgfile <<EOF
482
-Another message
483
-in a file.
484
-EOF
485
-get_tag_header file-annotated-tag $commit commit $time >expect
486
-cat msgfile >>expect
493
test_expect_success \
494
'creating an annotated tag with -F messagefile should succeed' '
495
+ cat >msgfile <<-\EOF &&
496
+ Another message
497
+ in a file.
498
+ EOF
499
+ get_tag_header file-annotated-tag $commit commit $time >expect &&
500
+ cat msgfile >>expect &&
501
git tag -F msgfile file-annotated-tag &&
502
get_tag_msg file-annotated-tag >actual &&
503
test_cmp expect actual
504
'
505
494
-get_tag_header file-annotated-tag-edit $commit commit $time >expect
495
-sed -e "s/Another message/Another edited message/g" msgfile >>expect
506
test_expect_success 'set up editor' '
507
write_script fakeeditor <<-\EOF
508
sed -e "s/Another message/Another edited message/g" <"$1" >"$1-"
509
mv "$1-" "$1"
510
EOF
511
'
512
+
513
test_expect_success \
514
'creating an annotated tag with -F messagefile --edit should succeed' '
515
+ get_tag_header file-annotated-tag-edit $commit commit $time >expect &&
516
+ sed -e "s/Another message/Another edited message/g" msgfile >>expect &&
517
GIT_EDITOR=./fakeeditor git tag -F msgfile --edit file-annotated-tag-edit &&
518
get_tag_msg file-annotated-tag-edit >actual &&
519
test_cmp expect actual
520
'
521
509
-cat >inputmsg <<EOF
510
-A message from the
511
-standard input
512
-EOF
513
-get_tag_header stdin-annotated-tag $commit commit $time >expect
514
-cat inputmsg >>expect
522
test_expect_success 'creating an annotated tag with -F - should succeed' '
523
+ cat >inputmsg <<-\EOF &&
524
+ A message from the
525
+ standard input
526
+ EOF
527
+ get_tag_header stdin-annotated-tag $commit commit $time >expect &&
528
+ cat inputmsg >>expect &&
529
git tag -F - stdin-annotated-tag <inputmsg &&
530
get_tag_msg stdin-annotated-tag >actual &&
531
test_cmp expect actual
@@ -541,67 +554,67 @@ test_expect_success \
554
555
# blank and empty messages:
556
544
-get_tag_header empty-annotated-tag $commit commit $time >expect
557
test_expect_success \
558
'creating a tag with an empty -m message should succeed' '
559
+ get_tag_header empty-annotated-tag $commit commit $time >expect &&
560
git tag -m "" empty-annotated-tag &&
561
get_tag_msg empty-annotated-tag >actual &&
562
test_cmp expect actual
563
'
564
552
->emptyfile
553
-get_tag_header emptyfile-annotated-tag $commit commit $time >expect
565
test_expect_success \
566
'creating a tag with an empty -F messagefile should succeed' '
567
+ >emptyfile &&
568
+ get_tag_header emptyfile-annotated-tag $commit commit $time >expect &&
569
git tag -F emptyfile emptyfile-annotated-tag &&
570
get_tag_msg emptyfile-annotated-tag >actual &&
571
test_cmp expect actual
572
'
573
561
-printf '\n\n \n\t\nLeading blank lines\n' >blanksfile
562
-printf '\n\t \t \nRepeated blank lines\n' >>blanksfile
563
-printf '\n\n\nTrailing spaces \t \n' >>blanksfile
564
-printf '\nTrailing blank lines\n\n\t \n\n' >>blanksfile
565
-get_tag_header blanks-annotated-tag $commit commit $time >expect
566
-cat >>expect <<EOF
567
-Leading blank lines
574
+test_expect_success \
575
+ 'extra blanks in the message for an annotated tag should be removed' '
576
+ printf "\n\n \n\t\nLeading blank lines\n" >blanksfile &&
577
+ printf "\n\t \t \nRepeated blank lines\n" >>blanksfile &&
578
+ printf "\n\n\nTrailing spaces \t \n" >>blanksfile &&
579
+ printf "\nTrailing blank lines\n\n\t \n\n" >>blanksfile &&
580
+ get_tag_header blanks-annotated-tag $commit commit $time >expect &&
581
+ cat >>expect <<-\EOF &&
582
+ Leading blank lines
583
569
-Repeated blank lines
584
+ Repeated blank lines
585
571
-Trailing spaces
586
+ Trailing spaces
587
573
-Trailing blank lines
574
-EOF
575
-test_expect_success \
576
- 'extra blanks in the message for an annotated tag should be removed' '
588
+ Trailing blank lines
589
+ EOF
590
git tag -F blanksfile blanks-annotated-tag &&
591
get_tag_msg blanks-annotated-tag >actual &&
592
test_cmp expect actual
593
'
594
582
-get_tag_header blank-annotated-tag $commit commit $time >expect
595
test_expect_success \
596
'creating a tag with blank -m message with spaces should succeed' '
597
+ get_tag_header blank-annotated-tag $commit commit $time >expect &&
598
git tag -m " " blank-annotated-tag &&
599
get_tag_msg blank-annotated-tag >actual &&
600
test_cmp expect actual
601
'
602
590
-echo ' ' >blankfile
591
-echo '' >>blankfile
592
-echo ' ' >>blankfile
593
-get_tag_header blankfile-annotated-tag $commit commit $time >expect
603
test_expect_success \
604
'creating a tag with blank -F messagefile with spaces should succeed' '
605
+ echo " " >blankfile &&
606
+ echo "" >>blankfile &&
607
+ echo " " >>blankfile &&
608
+ get_tag_header blankfile-annotated-tag $commit commit $time >expect &&
609
git tag -F blankfile blankfile-annotated-tag &&
610
get_tag_msg blankfile-annotated-tag >actual &&
611
test_cmp expect actual
612
'
613
601
-printf ' ' >blanknonlfile
602
-get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect
614
test_expect_success \
615
'creating a tag with -F file of spaces and no newline should succeed' '
616
+ printf " " >blanknonlfile &&
617
+ get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect &&
618
git tag -F blanknonlfile blanknonlfile-annotated-tag &&
619
get_tag_msg blanknonlfile-annotated-tag >actual &&
620
test_cmp expect actual
@@ -609,62 +622,62 @@ test_expect_success \
622
623
# messages with commented lines:
624
612
-cat >commentsfile <<EOF
613
-# A comment
625
+test_expect_success \
626
+ 'creating a tag using a -F messagefile with #comments should succeed' '
627
+ cat >commentsfile <<-\EOF &&
628
+ # A comment
629
615
-############
616
-The message.
617
-############
618
-One line.
630
+ ############
631
+ The message.
632
+ ############
633
+ One line.
634
635
621
-# commented lines
622
-# commented lines
636
+ # commented lines
637
+ # commented lines
638
624
-Another line.
625
-# comments
639
+ Another line.
640
+ # comments
641
627
-Last line.
628
-EOF
629
-get_tag_header comments-annotated-tag $commit commit $time >expect
630
-cat >>expect <<EOF
631
-The message.
632
-One line.
642
+ Last line.
643
+ EOF
644
+ get_tag_header comments-annotated-tag $commit commit $time >expect &&
645
+ cat >>expect <<-\EOF &&
646
+ The message.
647
+ One line.
648
634
-Another line.
649
+ Another line.
650
636
-Last line.
637
-EOF
638
-test_expect_success \
639
- 'creating a tag using a -F messagefile with #comments should succeed' '
651
+ Last line.
652
+ EOF
653
git tag -F commentsfile comments-annotated-tag &&
654
get_tag_msg comments-annotated-tag >actual &&
655
test_cmp expect actual
656
'
657
645
-get_tag_header comment-annotated-tag $commit commit $time >expect
658
test_expect_success \
659
'creating a tag with a #comment in the -m message should succeed' '
660
+ get_tag_header comment-annotated-tag $commit commit $time >expect &&
661
git tag -m "#comment" comment-annotated-tag &&
662
get_tag_msg comment-annotated-tag >actual &&
663
test_cmp expect actual
664
'
665
653
-echo '#comment' >commentfile
654
-echo '' >>commentfile
655
-echo '####' >>commentfile
656
-get_tag_header commentfile-annotated-tag $commit commit $time >expect
666
test_expect_success \
667
'creating a tag with #comments in the -F messagefile should succeed' '
668
+ echo "#comment" >commentfile &&
669
+ echo "" >>commentfile &&
670
+ echo "####" >>commentfile &&
671
+ get_tag_header commentfile-annotated-tag $commit commit $time >expect &&
672
git tag -F commentfile commentfile-annotated-tag &&
673
get_tag_msg commentfile-annotated-tag >actual &&
674
test_cmp expect actual
675
'
676
664
-printf '#comment' >commentnonlfile
665
-get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect
677
test_expect_success \
678
'creating a tag with a file of #comment and no newline should succeed' '
679
+ printf "#comment" >commentnonlfile &&
680
+ get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect &&
681
git tag -F commentnonlfile commentnonlfile-annotated-tag &&
682
get_tag_msg commentnonlfile-annotated-tag >actual &&
683
test_cmp expect actual
@@ -846,11 +859,11 @@ test_expect_success \
859
test_cmp expect actual
860
'
861
849
-echo 'tag line one' >annotagmsg
850
-echo 'tag line two' >>annotagmsg
851
-echo 'tag line three' >>annotagmsg
862
test_expect_success \
863
'listing many message lines of a non-signed tag should succeed' '
864
+ echo "tag line one" >annotagmsg &&
865
+ echo "tag line two" >>annotagmsg &&
866
+ echo "tag line three" >>annotagmsg &&
867
git tag -F annotagmsg tag-lines &&
868
869
echo "tag-lines" >expect &&
@@ -958,20 +971,20 @@ test_expect_success GPG \
971
972
# creating and verifying signed tags:
973
961
-get_tag_header signed-tag $commit commit $time >expect
962
-echo 'A signed tag message' >>expect
963
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
974
test_expect_success GPG 'creating a signed tag with -m message should succeed' '
975
+ get_tag_header signed-tag $commit commit $time >expect &&
976
+ echo "A signed tag message" >>expect &&
977
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
978
git tag -s -m "A signed tag message" signed-tag &&
979
get_tag_msg signed-tag >actual &&
980
test_cmp expect actual
981
'
982
970
-get_tag_header u-signed-tag $commit commit $time >expect
971
-echo 'Another message' >>expect
972
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
983
test_expect_success GPG 'sign with a given key id' '
984
985
+ get_tag_header u-signed-tag $commit commit $time >expect &&
986
+ echo "Another message" >>expect &&
987
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
988
git tag -u committer@example.com -m "Another message" u-signed-tag &&
989
get_tag_msg u-signed-tag >actual &&
990
test_cmp expect actual
@@ -991,65 +1004,65 @@ test_expect_success GPG 'sign with an unknown id (2)' '
1004
1005
'
1006
994
-cat >fakeeditor <<'EOF'
995
-#!/bin/sh
996
-test -n "$1" && exec >"$1"
997
-echo A signed tag message
998
-echo from a fake editor.
999
-EOF
1000
-chmod +x fakeeditor
1001
-
1002
-get_tag_header implied-sign $commit commit $time >expect
1003
-./fakeeditor >>expect
1004
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1007
test_expect_success GPG '-u implies signed tag' '
1008
+ cat >fakeeditor <<-\EOF &&
1009
+ #!/bin/sh
1010
+ test -n "$1" && exec >"$1"
1011
+ echo A signed tag message
1012
+ echo from a fake editor.
1013
+ EOF
1014
+ chmod +x fakeeditor &&
1015
+
1016
+ get_tag_header implied-sign $commit commit $time >expect &&
1017
+ ./fakeeditor >>expect &&
1018
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1019
GIT_EDITOR=./fakeeditor git tag -u CDDE430D implied-sign &&
1020
get_tag_msg implied-sign >actual &&
1021
test_cmp expect actual
1022
'
1023
1011
-cat >sigmsgfile <<EOF
1012
-Another signed tag
1013
-message in a file.
1014
-EOF
1015
-get_tag_header file-signed-tag $commit commit $time >expect
1016
-cat sigmsgfile >>expect
1017
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1024
test_expect_success GPG \
1025
'creating a signed tag with -F messagefile should succeed' '
1026
+ cat >sigmsgfile <<-\EOF &&
1027
+ Another signed tag
1028
+ message in a file.
1029
+ EOF
1030
+ get_tag_header file-signed-tag $commit commit $time >expect &&
1031
+ cat sigmsgfile >>expect &&
1032
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1033
git tag -s -F sigmsgfile file-signed-tag &&
1034
get_tag_msg file-signed-tag >actual &&
1035
test_cmp expect actual
1036
'
1037
1025
-cat >siginputmsg <<EOF
1026
-A signed tag message from
1027
-the standard input
1028
-EOF
1029
-get_tag_header stdin-signed-tag $commit commit $time >expect
1030
-cat siginputmsg >>expect
1031
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1038
test_expect_success GPG 'creating a signed tag with -F - should succeed' '
1039
+ cat >siginputmsg <<-\EOF &&
1040
+ A signed tag message from
1041
+ the standard input
1042
+ EOF
1043
+ get_tag_header stdin-signed-tag $commit commit $time >expect &&
1044
+ cat siginputmsg >>expect &&
1045
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1046
git tag -s -F - stdin-signed-tag <siginputmsg &&
1047
get_tag_msg stdin-signed-tag >actual &&
1048
test_cmp expect actual
1049
'
1050
1038
-get_tag_header implied-annotate $commit commit $time >expect
1039
-./fakeeditor >>expect
1040
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1051
test_expect_success GPG '-s implies annotated tag' '
1052
+ get_tag_header implied-annotate $commit commit $time >expect &&
1053
+ ./fakeeditor >>expect &&
1054
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1055
GIT_EDITOR=./fakeeditor git tag -s implied-annotate &&
1056
get_tag_msg implied-annotate >actual &&
1057
test_cmp expect actual
1058
'
1059
1047
-get_tag_header forcesignannotated-implied-sign $commit commit $time >expect
1048
-echo "A message" >>expect
1049
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1060
test_expect_success GPG \
1061
'git tag -s implied if configured with tag.forcesignannotated' \
1052
- 'test_config tag.forcesignannotated true &&
1062
+ 'get_tag_header forcesignannotated-implied-sign $commit commit $time >expect &&
1063
+ echo "A message" >>expect &&
1064
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1065
+ test_config tag.forcesignannotated true &&
1066
git tag -m "A message" forcesignannotated-implied-sign &&
1067
get_tag_msg forcesignannotated-implied-sign >actual &&
1068
test_cmp expect actual
@@ -1063,44 +1076,44 @@ test_expect_success GPG \
1076
test_must_fail git tag -v forcesignannotated-no-message
1077
'
1078
1066
-get_tag_header forcesignannotated-annotate $commit commit $time >expect
1067
-echo "A message" >>expect
1079
test_expect_success GPG \
1080
'git tag -a disable configured tag.forcesignannotated' \
1070
- 'test_config tag.forcesignannotated true &&
1081
+ 'get_tag_header forcesignannotated-annotate $commit commit $time >expect &&
1082
+ echo "A message" >>expect &&
1083
+ test_config tag.forcesignannotated true &&
1084
git tag -a -m "A message" forcesignannotated-annotate &&
1085
get_tag_msg forcesignannotated-annotate >actual &&
1086
test_cmp expect actual &&
1087
test_must_fail git tag -v forcesignannotated-annotate
1088
'
1089
1077
-get_tag_header forcesignannotated-disabled $commit commit $time >expect
1078
-echo "A message" >>expect
1079
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1090
test_expect_success GPG \
1091
'git tag --sign enable GPG sign' \
1082
- 'test_config tag.forcesignannotated false &&
1092
+ 'get_tag_header forcesignannotated-disabled $commit commit $time >expect &&
1093
+ echo "A message" >>expect &&
1094
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1095
+ test_config tag.forcesignannotated false &&
1096
git tag --sign -m "A message" forcesignannotated-disabled &&
1097
get_tag_msg forcesignannotated-disabled >actual &&
1098
test_cmp expect actual
1099
'
1100
1088
-get_tag_header gpgsign-enabled $commit commit $time >expect
1089
-echo "A message" >>expect
1090
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1101
test_expect_success GPG \
1102
'git tag configured tag.gpgsign enables GPG sign' \
1093
- 'test_config tag.gpgsign true &&
1103
+ 'get_tag_header gpgsign-enabled $commit commit $time >expect &&
1104
+ echo "A message" >>expect &&
1105
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1106
+ test_config tag.gpgsign true &&
1107
git tag -m "A message" gpgsign-enabled &&
1108
get_tag_msg gpgsign-enabled>actual &&
1109
test_cmp expect actual
1110
'
1111
1099
-get_tag_header no-sign $commit commit $time >expect
1100
-echo "A message" >>expect
1112
test_expect_success GPG \
1113
'git tag --no-sign configured tag.gpgsign skip GPG sign' \
1103
- 'test_config tag.gpgsign true &&
1114
+ 'get_tag_header no-sign $commit commit $time >expect &&
1115
+ echo "A message" >>expect &&
1116
+ test_config tag.gpgsign true &&
1117
git tag -a --no-sign -m "A message" no-sign &&
1118
get_tag_msg no-sign>actual &&
1119
test_cmp expect actual
@@ -1152,78 +1165,78 @@ test_expect_success GPG 'verifying a forged tag with --format should fail silent
1165
1166
# blank and empty messages for signed tags:
1167
1155
-get_tag_header empty-signed-tag $commit commit $time >expect
1156
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1168
test_expect_success GPG \
1169
'creating a signed tag with an empty -m message should succeed' '
1170
+ get_tag_header empty-signed-tag $commit commit $time >expect &&
1171
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1172
git tag -s -m "" empty-signed-tag &&
1173
get_tag_msg empty-signed-tag >actual &&
1174
test_cmp expect actual &&
1175
git tag -v empty-signed-tag
1176
'
1177
1165
->sigemptyfile
1166
-get_tag_header emptyfile-signed-tag $commit commit $time >expect
1167
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1178
test_expect_success GPG \
1179
'creating a signed tag with an empty -F messagefile should succeed' '
1180
+ >sigemptyfile &&
1181
+ get_tag_header emptyfile-signed-tag $commit commit $time >expect &&
1182
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1183
git tag -s -F sigemptyfile emptyfile-signed-tag &&
1184
get_tag_msg emptyfile-signed-tag >actual &&
1185
test_cmp expect actual &&
1186
git tag -v emptyfile-signed-tag
1187
'
1188
1176
-printf '\n\n \n\t\nLeading blank lines\n' >sigblanksfile
1177
-printf '\n\t \t \nRepeated blank lines\n' >>sigblanksfile
1178
-printf '\n\n\nTrailing spaces \t \n' >>sigblanksfile
1179
-printf '\nTrailing blank lines\n\n\t \n\n' >>sigblanksfile
1180
-get_tag_header blanks-signed-tag $commit commit $time >expect
1181
-cat >>expect <<EOF
1182
-Leading blank lines
1189
+test_expect_success GPG \
1190
+ 'extra blanks in the message for a signed tag should be removed' '
1191
+ printf "\n\n \n\t\nLeading blank lines\n" >sigblanksfile &&
1192
+ printf "\n\t \t \nRepeated blank lines\n" >>sigblanksfile &&
1193
+ printf "\n\n\nTrailing spaces \t \n" >>sigblanksfile &&
1194
+ printf "\nTrailing blank lines\n\n\t \n\n" >>sigblanksfile &&
1195
+ get_tag_header blanks-signed-tag $commit commit $time >expect &&
1196
+ cat >>expect <<-\EOF &&
1197
+ Leading blank lines
1198
1184
-Repeated blank lines
1199
+ Repeated blank lines
1200
1186
-Trailing spaces
1201
+ Trailing spaces
1202
1188
-Trailing blank lines
1189
-EOF
1190
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1191
-test_expect_success GPG \
1192
- 'extra blanks in the message for a signed tag should be removed' '
1203
+ Trailing blank lines
1204
+ EOF
1205
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1206
git tag -s -F sigblanksfile blanks-signed-tag &&
1207
get_tag_msg blanks-signed-tag >actual &&
1208
test_cmp expect actual &&
1209
git tag -v blanks-signed-tag
1210
'
1211
1199
-get_tag_header blank-signed-tag $commit commit $time >expect
1200
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1212
test_expect_success GPG \
1213
'creating a signed tag with a blank -m message should succeed' '
1214
+ get_tag_header blank-signed-tag $commit commit $time >expect &&
1215
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1216
git tag -s -m " " blank-signed-tag &&
1217
get_tag_msg blank-signed-tag >actual &&
1218
test_cmp expect actual &&
1219
git tag -v blank-signed-tag
1220
'
1221
1209
-echo ' ' >sigblankfile
1210
-echo '' >>sigblankfile
1211
-echo ' ' >>sigblankfile
1212
-get_tag_header blankfile-signed-tag $commit commit $time >expect
1213
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1222
test_expect_success GPG \
1223
'creating a signed tag with blank -F file with spaces should succeed' '
1224
+ echo " " >sigblankfile &&
1225
+ echo "" >>sigblankfile &&
1226
+ echo " " >>sigblankfile &&
1227
+ get_tag_header blankfile-signed-tag $commit commit $time >expect &&
1228
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1229
git tag -s -F sigblankfile blankfile-signed-tag &&
1230
get_tag_msg blankfile-signed-tag >actual &&
1231
test_cmp expect actual &&
1232
git tag -v blankfile-signed-tag
1233
'
1234
1222
-printf ' ' >sigblanknonlfile
1223
-get_tag_header blanknonlfile-signed-tag $commit commit $time >expect
1224
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1235
test_expect_success GPG \
1236
'creating a signed tag with spaces and no newline should succeed' '
1237
+ printf " " >sigblanknonlfile &&
1238
+ get_tag_header blanknonlfile-signed-tag $commit commit $time >expect &&
1239
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1240
git tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&
1241
get_tag_msg blanknonlfile-signed-tag >actual &&
1242
test_cmp expect actual &&
@@ -1243,69 +1256,69 @@ test_expect_success GPG 'signed tag with embedded PGP message' '
1256
1257
# messages with commented lines for signed tags:
1258
1246
-cat >sigcommentsfile <<EOF
1247
-# A comment
1259
+test_expect_success GPG \
1260
+ 'creating a signed tag with a -F file with #comments should succeed' '
1261
+ cat >sigcommentsfile <<-\EOF &&
1262
+ # A comment
1263
1249
-############
1250
-The message.
1251
-############
1252
-One line.
1264
+ ############
1265
+ The message.
1266
+ ############
1267
+ One line.
1268
1269
1255
-# commented lines
1256
-# commented lines
1270
+ # commented lines
1271
+ # commented lines
1272
1258
-Another line.
1259
-# comments
1273
+ Another line.
1274
+ # comments
1275
1261
-Last line.
1262
-EOF
1263
-get_tag_header comments-signed-tag $commit commit $time >expect
1264
-cat >>expect <<EOF
1265
-The message.
1266
-One line.
1276
+ Last line.
1277
+ EOF
1278
+ get_tag_header comments-signed-tag $commit commit $time >expect &&
1279
+ cat >>expect <<-\EOF &&
1280
+ The message.
1281
+ One line.
1282
1268
-Another line.
1283
+ Another line.
1284
1270
-Last line.
1271
-EOF
1272
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1273
-test_expect_success GPG \
1274
- 'creating a signed tag with a -F file with #comments should succeed' '
1285
+ Last line.
1286
+ EOF
1287
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1288
git tag -s -F sigcommentsfile comments-signed-tag &&
1289
get_tag_msg comments-signed-tag >actual &&
1290
test_cmp expect actual &&
1291
git tag -v comments-signed-tag
1292
'
1293
1281
-get_tag_header comment-signed-tag $commit commit $time >expect
1282
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1294
test_expect_success GPG \
1295
'creating a signed tag with #commented -m message should succeed' '
1296
+ get_tag_header comment-signed-tag $commit commit $time >expect &&
1297
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1298
git tag -s -m "#comment" comment-signed-tag &&
1299
get_tag_msg comment-signed-tag >actual &&
1300
test_cmp expect actual &&
1301
git tag -v comment-signed-tag
1302
'
1303
1291
-echo '#comment' >sigcommentfile
1292
-echo '' >>sigcommentfile
1293
-echo '####' >>sigcommentfile
1294
-get_tag_header commentfile-signed-tag $commit commit $time >expect
1295
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1304
test_expect_success GPG \
1305
'creating a signed tag with #commented -F messagefile should succeed' '
1306
+ echo "#comment" >sigcommentfile &&
1307
+ echo "" >>sigcommentfile &&
1308
+ echo "####" >>sigcommentfile &&
1309
+ get_tag_header commentfile-signed-tag $commit commit $time >expect &&
1310
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1311
git tag -s -F sigcommentfile commentfile-signed-tag &&
1312
get_tag_msg commentfile-signed-tag >actual &&
1313
test_cmp expect actual &&
1314
git tag -v commentfile-signed-tag
1315
'
1316
1304
-printf '#comment' >sigcommentnonlfile
1305
-get_tag_header commentnonlfile-signed-tag $commit commit $time >expect
1306
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1317
test_expect_success GPG \
1318
'creating a signed tag with a #comment and no newline should succeed' '
1319
+ printf "#comment" >sigcommentnonlfile &&
1320
+ get_tag_header commentnonlfile-signed-tag $commit commit $time >expect &&
1321
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1322
git tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&
1323
get_tag_msg commentnonlfile-signed-tag >actual &&
1324
test_cmp expect actual &&
@@ -1364,11 +1377,11 @@ test_expect_success GPG \
1377
test_cmp expect actual
1378
'
1379
1367
-echo 'stag line one' >sigtagmsg
1368
-echo 'stag line two' >>sigtagmsg
1369
-echo 'stag line three' >>sigtagmsg
1380
test_expect_success GPG \
1381
'listing many message lines of a signed tag should succeed' '
1382
+ echo "stag line one" >sigtagmsg &&
1383
+ echo "stag line two" >>sigtagmsg &&
1384
+ echo "stag line three" >>sigtagmsg &&
1385
git tag -s -F sigtagmsg stag-lines &&
1386
1387
echo "stag-lines" >expect &&
@@ -1410,60 +1423,59 @@ test_expect_success GPG \
1423
1424
# tags pointing to objects different from commits:
1425
1413
-tree=$(git rev-parse HEAD^{tree})
1414
-blob=$(git rev-parse HEAD:foo)
1415
-tag=$(git rev-parse signed-tag 2>/dev/null)
1416
-
1417
-get_tag_header tree-signed-tag $tree tree $time >expect
1418
-echo "A message for a tree" >>expect
1419
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1426
test_expect_success GPG \
1427
'creating a signed tag pointing to a tree should succeed' '
1428
+ tree=$(git rev-parse HEAD^{tree}) &&
1429
+ get_tag_header tree-signed-tag $tree tree $time >expect &&
1430
+ echo "A message for a tree" >>expect &&
1431
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1432
git tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} &&
1433
get_tag_msg tree-signed-tag >actual &&
1434
test_cmp expect actual
1435
'
1436
1427
-get_tag_header blob-signed-tag $blob blob $time >expect
1428
-echo "A message for a blob" >>expect
1429
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1437
test_expect_success GPG \
1438
'creating a signed tag pointing to a blob should succeed' '
1439
+ blob=$(git rev-parse HEAD:foo) &&
1440
+ get_tag_header blob-signed-tag $blob blob $time >expect &&
1441
+ echo "A message for a blob" >>expect &&
1442
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1443
git tag -s -m "A message for a blob" blob-signed-tag HEAD:foo &&
1444
get_tag_msg blob-signed-tag >actual &&
1445
test_cmp expect actual
1446
'
1447
1437
-get_tag_header tag-signed-tag $tag tag $time >expect
1438
-echo "A message for another tag" >>expect
1439
-echo '-----BEGIN PGP SIGNATURE-----' >>expect
1448
test_expect_success GPG \
1449
'creating a signed tag pointing to another tag should succeed' '
1450
+ tag=$(git rev-parse signed-tag 2>/dev/null) &&
1451
+ get_tag_header tag-signed-tag $tag tag $time >expect &&
1452
+ echo "A message for another tag" >>expect &&
1453
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect &&
1454
git tag -s -m "A message for another tag" tag-signed-tag signed-tag &&
1455
get_tag_msg tag-signed-tag >actual &&
1456
test_cmp expect actual
1457
'
1458
1459
# usage with rfc1991 signatures
1448
-get_tag_header rfc1991-signed-tag $commit commit $time >expect
1449
-echo "RFC1991 signed tag" >>expect
1450
-echo '-----BEGIN PGP MESSAGE-----' >>expect
1460
+
1461
test_expect_success GPG,RFC1991 \
1462
'creating a signed tag with rfc1991' '
1463
+ get_tag_header rfc1991-signed-tag $commit commit $time >expect &&
1464
+ echo "RFC1991 signed tag" >>expect &&
1465
+ echo "-----BEGIN PGP MESSAGE-----" >>expect &&
1466
echo "rfc1991" >gpghome/gpg.conf &&
1467
git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit &&
1468
get_tag_msg rfc1991-signed-tag >actual &&
1469
test_cmp expect actual
1470
'
1471
1459
-cat >fakeeditor <<'EOF'
1460
-#!/bin/sh
1461
-cp "$1" actual
1462
-EOF
1463
-chmod +x fakeeditor
1464
-
1472
test_expect_success GPG,RFC1991 \
1473
'reediting a signed tag body omits signature' '
1474
+ cat >fakeeditor <<-\EOF &&
1475
+ #!/bin/sh
1476
+ cp "$1" actual
1477
+ EOF
1478
+ chmod +x fakeeditor &&
1479
echo "rfc1991" >gpghome/gpg.conf &&
1480
echo "RFC1991 signed tag" >expect &&
1481
GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
@@ -1488,10 +1500,9 @@ test_expect_success GPG,RFC1991 \
1500
test_cmp expect actual
1501
'
1502
1491
-rm -f gpghome/gpg.conf
1492
-
1503
test_expect_success GPG,RFC1991 \
1504
'verifying rfc1991 signature without --rfc1991' '
1505
+ rm -f gpghome/gpg.conf &&
1506
git tag -v rfc1991-signed-tag
1507
'
1508
@@ -1559,10 +1570,11 @@ test_expect_success GPGSM \
1570
1571
# try to verify without gpg:
1572
1562
-rm -rf gpghome
1573
test_expect_success GPG \
1574
'verify signed tag fails when public key is not present' \
1565
- 'test_must_fail git tag -v signed-tag'
1575
+ 'rm -rf gpghome &&
1576
+ test_must_fail git tag -v signed-tag
1577
+'
1578
1579
test_expect_success \
1580
'git tag -a fails if tag annotation is empty' '
@@ -1588,10 +1600,10 @@ test_expect_success \
1600
test_must_be_empty rest.actual
1601
'
1602
1591
-get_tag_header reuse $commit commit $time >expect
1592
-echo "An annotation to be reused" >>expect
1603
test_expect_success \
1604
'overwriting an annotated tag should use its previous body' '
1605
+ get_tag_header reuse $commit commit $time >expect &&
1606
+ echo "An annotation to be reused" >>expect &&
1607
git tag -a -m "An annotation to be reused" reuse &&
1608
GIT_EDITOR=true git tag -f -a reuse &&
1609
get_tag_msg reuse >actual &&
@@ -1620,47 +1632,57 @@ test_expect_success 'filename for the message is relative to cwd' '
1632
1633
# create a few more commits to test --contains
1634
1623
-hash1=$(git rev-parse HEAD)
1624
-
1635
test_expect_success 'creating second commit and tag' '
1636
+ hash1=$(git rev-parse HEAD) &&
1637
echo foo-2.0 >foo &&
1638
git add foo &&
1639
git commit -m second &&
1640
git tag v2.0
1641
'
1642
1632
-hash2=$(git rev-parse HEAD)
1633
-
1643
test_expect_success 'creating third commit without tag' '
1644
+ hash2=$(git rev-parse HEAD) &&
1645
echo foo-dev >foo &&
1646
git add foo &&
1647
git commit -m third
1648
'
1649
1640
-hash3=$(git rev-parse HEAD)
1641
-
1650
# simple linear checks of --continue
1651
1644
-cat >expected <<EOF
1645
-v0.2.1
1646
-v1.0
1647
-v1.0.1
1648
-v1.1.3
1649
-v2.0
1650
-EOF
1651
-
1652
test_expect_success 'checking that first commit is in all tags (hash)' "
1653
+ hash3=$(git rev-parse HEAD) &&
1654
+ cat >expected <<-\EOF &&
1655
+ v0.2.1
1656
+ v1.0
1657
+ v1.0.1
1658
+ v1.1.3
1659
+ v2.0
1660
+ EOF
1661
git tag -l --contains $hash1 v* >actual &&
1662
test_cmp expected actual
1663
"
1664
1665
# other ways of specifying the commit
1666
test_expect_success 'checking that first commit is in all tags (tag)' "
1667
+ cat >expected <<-\EOF &&
1668
+ v0.2.1
1669
+ v1.0
1670
+ v1.0.1
1671
+ v1.1.3
1672
+ v2.0
1673
+ EOF
1674
git tag -l --contains v1.0 v* >actual &&
1675
test_cmp expected actual
1676
"
1677
1678
test_expect_success 'checking that first commit is in all tags (relative)' "
1679
+ cat >expected <<-\EOF &&
1680
+ v0.2.1
1681
+ v1.0
1682
+ v1.0.1
1683
+ v1.1.3
1684
+ v2.0
1685
+ EOF
1686
git tag -l --contains HEAD~2 v* >actual &&
1687
test_cmp expected actual
1688
"
@@ -1681,23 +1703,21 @@ test_expect_success 'checking that first commit is in all tags (relative)' "
1703
test_must_be_empty actual
1704
"
1705
1684
-cat >expected <<EOF
1685
-v2.0
1686
-EOF
1687
-
1706
test_expect_success 'checking that second commit only has one tag' "
1707
+ cat >expected <<-\EOF &&
1708
+ v2.0
1709
+ EOF
1710
git tag -l --contains $hash2 v* >actual &&
1711
test_cmp expected actual
1712
"
1713
1693
-cat >expected <<EOF
1694
-v0.2.1
1695
-v1.0
1696
-v1.0.1
1697
-v1.1.3
1698
-EOF
1699
-
1714
test_expect_success 'inverse of the last test, with --no-contains' "
1715
+ cat >expected <<-\EOF &&
1716
+ v0.2.1
1717
+ v1.0
1718
+ v1.0.1
1719
+ v1.1.3
1720
+ EOF
1721
git tag -l --no-contains $hash2 v* >actual &&
1722
test_cmp expected actual
1723
"
@@ -1707,15 +1727,14 @@ test_expect_success 'checking that third commit has no tags' "
1727
test_must_be_empty actual
1728
"
1729
1710
-cat >expected <<EOF
1711
-v0.2.1
1712
-v1.0
1713
-v1.0.1
1714
-v1.1.3
1715
-v2.0
1716
-EOF
1717
-
1730
test_expect_success 'conversely --no-contains on the third commit lists all tags' "
1731
+ cat >expected <<-\EOF &&
1732
+ v0.2.1
1733
+ v1.0
1734
+ v1.0.1
1735
+ v1.1.3
1736
+ v2.0
1737
+ EOF
1738
git tag -l --no-contains $hash3 v* >actual &&
1739
test_cmp expected actual
1740
"
@@ -1730,26 +1749,23 @@ test_expect_success 'creating simple branch' '
1749
git tag v3.0
1750
'
1751
1733
-hash4=$(git rev-parse HEAD)
1734
-
1735
-cat >expected <<EOF
1736
-v3.0
1737
-EOF
1738
-
1739
-test_expect_success 'checking that branch head only has one tag' "
1752
+test_expect_success 'checking that branch head only has one tag' '
1753
+ hash4=$(git rev-parse HEAD) &&
1754
+ cat >expected <<-\EOF &&
1755
+ v3.0
1756
+ EOF
1757
git tag -l --contains $hash4 v* >actual &&
1758
test_cmp expected actual
1742
-"
1743
-
1744
-cat >expected <<EOF
1745
-v0.2.1
1746
-v1.0
1747
-v1.0.1
1748
-v1.1.3
1749
-v2.0
1750
-EOF
1759
+'
1760
1761
test_expect_success 'checking that branch head with --no-contains lists all but one tag' "
1762
+ cat >expected <<-\EOF &&
1763
+ v0.2.1
1764
+ v1.0
1765
+ v1.0.1
1766
+ v1.1.3
1767
+ v2.0
1768
+ EOF
1769
git tag -l --no-contains $hash4 v* >actual &&
1770
test_cmp expected actual
1771
"
@@ -1759,45 +1775,51 @@ test_expect_success 'merging original branch into this branch' '
1775
git tag v4.0
1776
'
1777
1762
-cat >expected <<EOF
1763
-v4.0
1764
-EOF
1765
-
1778
test_expect_success 'checking that original branch head has one tag now' "
1779
+ cat >expected <<-\EOF &&
1780
+ v4.0
1781
+ EOF
1782
git tag -l --contains $hash3 v* >actual &&
1783
test_cmp expected actual
1784
"
1785
1771
-cat >expected <<EOF
1772
-v0.2.1
1773
-v1.0
1774
-v1.0.1
1775
-v1.1.3
1776
-v2.0
1777
-v3.0
1778
-EOF
1779
-
1786
test_expect_success 'checking that original branch head with --no-contains lists all but one tag now' "
1787
+ cat >expected <<-\EOF &&
1788
+ v0.2.1
1789
+ v1.0
1790
+ v1.0.1
1791
+ v1.1.3
1792
+ v2.0
1793
+ v3.0
1794
+ EOF
1795
git tag -l --no-contains $hash3 v* >actual &&
1796
test_cmp expected actual
1797
"
1798
1785
-cat >expected <<EOF
1786
-v0.2.1
1787
-v1.0
1788
-v1.0.1
1789
-v1.1.3
1790
-v2.0
1791
-v3.0
1792
-v4.0
1793
-EOF
1794
-
1799
test_expect_success 'checking that initial commit is in all tags' "
1800
+ cat >expected <<-\EOF &&
1801
+ v0.2.1
1802
+ v1.0
1803
+ v1.0.1
1804
+ v1.1.3
1805
+ v2.0
1806
+ v3.0
1807
+ v4.0
1808
+ EOF
1809
git tag -l --contains $hash1 v* >actual &&
1810
test_cmp expected actual
1811
"
1812
1813
test_expect_success 'checking that --contains can be used in non-list mode' '
1814
+ cat >expected <<-\EOF &&
1815
+ v0.2.1
1816
+ v1.0
1817
+ v1.0.1
1818
+ v1.1.3
1819
+ v2.0
1820
+ v3.0
1821
+ v4.0
1822
+ EOF
1823
git tag --contains $hash1 v* >actual &&
1824
test_cmp expected actual
1825
'