sequencer (rebase -i): record interrupted commits in rewritten, too
[gitweb.git] / t / t7004-tag.sh
index c64579fe152bac31e5b2d1acf8179248be6f6e89..07869b0c09da1313dd5564c2318dc5d44818f3a9 100755 (executable)
@@ -23,8 +23,32 @@ test_expect_success 'listing all tags in an empty tree should succeed' '
 '
 
 test_expect_success 'listing all tags in an empty tree should output nothing' '
-       test `git tag -l | wc -l` -eq 0 &&
-       test `git tag | wc -l` -eq 0
+       test $(git tag -l | wc -l) -eq 0 &&
+       test $(git tag | wc -l) -eq 0
+'
+
+test_expect_success 'sort tags, ignore case' '
+       (
+               git init sort &&
+               cd sort &&
+               test_commit initial &&
+               git tag tag-one &&
+               git tag TAG-two &&
+               git tag -l >actual &&
+               cat >expected <<-\EOF &&
+               TAG-two
+               initial
+               tag-one
+               EOF
+               test_cmp expected actual &&
+               git tag -l -i >actual &&
+               cat >expected <<-\EOF &&
+               initial
+               tag-one
+               TAG-two
+               EOF
+               test_cmp expected actual
+       )
 '
 
 test_expect_success 'looking for a tag in an empty tree should fail' \
@@ -72,8 +96,8 @@ test_expect_success 'listing all tags if one exists should succeed' '
 '
 
 test_expect_success 'listing all tags if one exists should output that tag' '
-       test `git tag -l` = mytag &&
-       test `git tag` = mytag
+       test $(git tag -l) = mytag &&
+       test $(git tag) = mytag
 '
 
 # pattern matching:
@@ -81,9 +105,12 @@ test_expect_success 'listing all tags if one exists should output that tag' '
 test_expect_success 'listing a tag using a matching pattern should succeed' \
        'git tag -l mytag'
 
+test_expect_success 'listing a tag with --ignore-case' \
+       'test $(git tag -l --ignore-case MYTAG) = mytag'
+
 test_expect_success \
        'listing a tag using a matching pattern should output that tag' \
-       'test `git tag -l mytag` = mytag'
+       'test $(git tag -l mytag) = mytag'
 
 # todo: git tag -l now returns always zero, when fixed, change this test
 test_expect_success \
@@ -92,7 +119,7 @@ test_expect_success \
 
 test_expect_success \
        'listing tags using a non-matching pattern should output nothing' \
-       'test `git tag -l xxx | wc -l` -eq 0'
+       'test $(git tag -l xxx | wc -l) -eq 0'
 
 # special cases for creating tags:
 
@@ -102,13 +129,13 @@ test_expect_success \
 
 test_expect_success \
        'trying to create a tag with a non-valid name should fail' '
-       test `git tag -l | wc -l` -eq 1 &&
+       test $(git tag -l | wc -l) -eq 1 &&
        test_must_fail git tag "" &&
        test_must_fail git tag .othertag &&
        test_must_fail git tag "other tag" &&
        test_must_fail git tag "othertag^" &&
        test_must_fail git tag "other~tag" &&
-       test `git tag -l | wc -l` -eq 1
+       test $(git tag -l | wc -l) -eq 1
 '
 
 test_expect_success 'creating a tag using HEAD directly should succeed' '
@@ -775,6 +802,47 @@ test_expect_success GPG '-s implies annotated tag' '
        test_cmp expect actual
 '
 
+get_tag_header forcesignannotated-implied-sign $commit commit $time >expect
+echo "A message" >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success GPG \
+       'git tag -s implied if configured with tag.forcesignannotated' \
+       'test_config tag.forcesignannotated true &&
+       git tag -m "A message" forcesignannotated-implied-sign &&
+       get_tag_msg forcesignannotated-implied-sign >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success GPG \
+       'lightweight with no message when configured with tag.forcesignannotated' \
+       'test_config tag.forcesignannotated true &&
+       git tag forcesignannotated-lightweight &&
+       tag_exists forcesignannotated-lightweight &&
+       test_must_fail git tag -v forcesignannotated-no-message
+'
+
+get_tag_header forcesignannotated-annotate $commit commit $time >expect
+echo "A message" >>expect
+test_expect_success GPG \
+       'git tag -a disable configured tag.forcesignannotated' \
+       'test_config tag.forcesignannotated true &&
+       git tag -a -m "A message" forcesignannotated-annotate &&
+       get_tag_msg forcesignannotated-annotate >actual &&
+       test_cmp expect actual &&
+       test_must_fail git tag -v forcesignannotated-annotate
+'
+
+get_tag_header forcesignannotated-disabled $commit commit $time >expect
+echo "A message" >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success GPG \
+       'git tag --sign enable GPG sign' \
+       'test_config tag.forcesignannotated false &&
+       git tag --sign -m "A message" forcesignannotated-disabled &&
+       get_tag_msg forcesignannotated-disabled >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success GPG \
        'trying to create a signed tag with non-existing -F file should fail' '
        ! test -f nonexistingfile &&
@@ -1161,10 +1229,17 @@ test_expect_success GPG,RFC1991 \
 # try to sign with bad user.signingkey
 git config user.signingkey BobTheMouse
 test_expect_success GPG \
-       'git tag -s fails if gpg is misconfigured' \
+       'git tag -s fails if gpg is misconfigured (bad key)' \
        'test_must_fail git tag -s -m tail tag-gpg-failure'
 git config --unset user.signingkey
 
+# try to produce invalid signature
+test_expect_success GPG \
+       'git tag -s fails if gpg is misconfigured (bad signature format)' \
+       'test_config gpg.program echo &&
+        test_must_fail git tag -s -m tail tag-gpg-failure'
+
+
 # try to verify without gpg:
 
 rm -rf gpghome