Merge branch 'wc/diff'
[gitweb.git] / t / t7004-tag.sh
index 5f7e388d7add06b8392997037a86c4d0f8524ceb..09d56e0839f042a74bee5c13ab251f19fcc2c76e 100755 (executable)
@@ -339,20 +339,14 @@ test_expect_success \
 '
 
 test_expect_success \
-       'trying to create tags giving many -m or -F options should fail' '
+       'trying to create tags giving both -m or -F options should fail' '
        echo "message file 1" >msgfile1 &&
        echo "message file 2" >msgfile2 &&
        ! tag_exists msgtag &&
-       ! git-tag -m "message 1" -m "message 2" msgtag &&
-       ! tag_exists msgtag &&
-       ! git-tag -F msgfile1 -F msgfile2 msgtag &&
-       ! tag_exists msgtag &&
        ! git-tag -m "message 1" -F msgfile1 msgtag &&
        ! tag_exists msgtag &&
        ! git-tag -F msgfile1 -m "message 1" msgtag &&
        ! tag_exists msgtag &&
-       ! git-tag -F msgfile1 -m "message 1" -F msgfile2 msgtag &&
-       ! tag_exists msgtag &&
        ! git-tag -m "message 1" -F msgfile1 -m "message 2" msgtag &&
        ! tag_exists msgtag
 '
@@ -646,6 +640,46 @@ test_expect_success 'creating a signed tag with -m message should succeed' '
        git diff expect actual
 '
 
+get_tag_header u-signed-tag $commit commit $time >expect
+echo 'Another message' >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success 'sign with a given key id' '
+
+       git tag -u committer@example.com -m "Another message" u-signed-tag &&
+       get_tag_msg u-signed-tag >actual &&
+       git diff expect actual
+
+'
+
+test_expect_success 'sign with an unknown id (1)' '
+
+       ! git tag -u author@example.com -m "Another message" o-signed-tag
+
+'
+
+test_expect_success 'sign with an unknown id (2)' '
+
+       ! git tag -u DEADBEEF -m "Another message" o-signed-tag
+
+'
+
+cat >fakeeditor <<'EOF'
+#!/bin/sh
+test -n "$1" && exec >"$1"
+echo A signed tag message
+echo from a fake editor.
+EOF
+chmod +x fakeeditor
+
+get_tag_header implied-sign $commit commit $time >expect
+./fakeeditor >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success '-u implies signed tag' '
+       GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign &&
+       get_tag_msg implied-sign >actual &&
+       git diff expect actual
+'
+
 cat >sigmsgfile <<EOF
 Another signed tag
 message in a file.
@@ -673,6 +707,15 @@ test_expect_success 'creating a signed tag with -F - should succeed' '
        git diff expect actual
 '
 
+get_tag_header implied-annotate $commit commit $time >expect
+./fakeeditor >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success '-s implies annotated tag' '
+       GIT_EDITOR=./fakeeditor git-tag -s implied-annotate &&
+       get_tag_msg implied-annotate >actual &&
+       git diff expect actual
+'
+
 test_expect_success \
        'trying to create a signed tag with non-existing -F file should fail' '
        ! test -f nonexistingfile &&