{"thread":{"id":"8600","subject":"[PATCH] Add test-script for git-tag","startedAt":"2007-06-14T16:45:01Z","lastAt":"2007-06-16T05:14:48Z","messageCount":3,"participants":["Carlos Rica","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45086","messageId":"1b46aba20706140945i2545c06fxce3fda71fe59a7af@mail.gmail.com","threadId":"8600","inReplyTo":null,"subject":"[PATCH] Add test-script for git-tag","fromName":"Carlos Rica","fromEmail":"jasampler@gmail.com","sentAt":"2007-06-14T16:45:01Z","receivedAt":"2007-06-14T16:45:01Z","isPatch":true,"sender":{"key":"jasampler@gmail.com","avatar":null},"body":"These tests are useful to develop the C version for git-tag.sh,\nensuring that the future builtin-tag.c will not break previous\nbehaviour.\n\nThe tests are focused on listing, verifying, deleting and creating\ntags, checking always that the correct status value is returned\nand everything remains as expected.\n\nIn order to verify and create signed tags, a PGP key was also\nadded, being created this way: gpg --homedir t/t7003 --gen-key\nType DSA and Elgamal, size 2048 bits, no expiration date.\nName and email: C O Mitter <committer@example.com>\nNo password given, to enable non-interactive operation.\n\nSigned-off-by: Carlos Rica <jasampler@gmail.com>\n\ndiff --git a/t/t7003-tag.sh b/t/t7003-tag.sh\nnew file mode 100755\nindex 0000000..d998dd2\n--- /dev/null\n+++ b/t/t7003-tag.sh\n@@ -0,0 +1,616 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Carlos Rica\n+#\n+\n+test_description='git-tag\n+\n+Basic tests for operations with tags.'\n+\n+. ./test-lib.sh\n+\n+# creating and listing lightweight tags:\n+\n+tag_exists () {\n+\tgit show-ref --quiet --verify refs/tags/$1\n+}\n+\n+test_expect_success 'listing all tags in an empty tree now should succeed' \\\n+\t'git tag -l'\n+\n+test_expect_success 'listing all tags in an empty tree should output nothing' \\\n+\t'test `git-tag -l | wc -l` -eq 0'\n+\n+test_expect_failure 'looking for a tag in an empty tree should fail' \\\n+\t'tag_exists mytag'\n+\n+test_expect_failure 'creating a tag in an empty tree should fail' '\n+\tgit-tag mynotag ||\n+\ttag_exists mynotag\n+'\n+\n+test_expect_failure 'creating a tag for HEAD in an empty tree should fail' '\n+\tgit-tag mytaghead HEAD ||\n+\ttag_exists mytaghead\n+'\n+\n+test_expect_failure 'creating a tag for an unknown revision should fail' '\n+\tgit-tag mytagnorev aaaaaaaaaaa ||\n+\ttag_exists mytagnorev\n+'\n+\n+test_expect_success 'creating a tag using default HEAD should succeed' '\n+\techo foo >foo &&\n+\tgit add foo &&\n+\ttest_tick && git commit -m Foo &&\n+\tgit tag mytag\n+'\n+\n+test_expect_success 'listing all tags if one exists now also should succeed' \\\n+\t'git-tag -l'\n+\n+test_expect_success 'listing all tags if one exists should output that tag' \\\n+\t'test `git-tag -l` = mytag'\n+\n+# pattern matching:\n+\n+test_expect_success 'listing a tag using a matching pattern should succeed' \\\n+\t'git-tag -l mytag'\n+\n+test_expect_success \\\n+\t'listing a tag using a matching pattern should output that tag' \\\n+\t'test `git-tag -l mytag` = mytag'\n+\n+test_expect_success \\\n+\t'listing tags using a non-matching pattern now should suceed' \\\n+\t'git-tag -l xxx'\n+\n+test_expect_success \\\n+\t'listing tags using a non-matching pattern should output nothing' \\\n+\t'test `git-tag -l xxx | wc -l` -eq 0'\n+\n+# special cases for creating tags:\n+\n+test_expect_failure \\\n+\t'trying to create a tag with the name of one existing should fail' \\\n+\t'git tag mytag'\n+\n+test_expect_failure 'trying to create a tag with a non-valid name\nshould fail' '\n+\ttest `git-tag -l | wc -l` -ne 1 ||\n+\tgit tag .othertag ||\n+\tgit tag \"other tag\" ||\n+\tgit tag \"othertag^\" ||\n+\tgit tag \"other~tag\" ||\n+\ttest `git-tag -l | wc -l` -ne 1\n+'\n+\n+test_expect_success 'creating a tag using HEAD directly should succeed' '\n+\tgit tag myhead HEAD &&\n+\ttag_exists myhead\n+'\n+\n+# deleting tags:\n+\n+test_expect_failure 'trying to delete an unknown tag should fail' '\n+\ttag_exists unknown-tag ||\n+\tgit-tag -d unknown-tag\n+'\n+\n+cat >expect <<EOF\n+myhead\n+mytag\n+EOF\n+test_expect_success \\\n+\t'trying to delete tags without params should succeed and do nothing' '\n+\tgit tag -l > actual && git diff expect actual &&\n+\tgit-tag -d &&\n+\tgit tag -l > actual && git diff expect actual\n+'\n+\n+test_expect_success \\\n+\t'deleting two existing tags in one command should succeed' '\n+\ttag_exists mytag &&\n+\ttag_exists myhead &&\n+\tgit-tag -d mytag myhead &&\n+\t! tag_exists mytag &&\n+\t! tag_exists myhead\n+'\n+\n+test_expect_success \\\n+\t'creating a tag with the name of another deleted one should succeed' '\n+\t! tag_exists mytag &&\n+\tgit-tag mytag &&\n+\ttag_exists mytag\n+'\n+\n+test_expect_failure \\\n+\t'trying to delete two tags -existing and not- should fail for the 2nd' '\n+\ttag_exists mytag &&\n+\t! tag_exists myhead &&\n+\tgit-tag -d mytag anothertag\n+\t! tag_exists mytag &&\n+\t! tag_exists myhead &&\n+'\n+\n+test_expect_failure 'trying to delete an already deleted tag should fail' \\\n+\t'git-tag -d mytag'\n+\n+# listing various tags with pattern matching:\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+cba\n+t210\n+t211\n+v0.2.1\n+v1.0\n+v1.0.1\n+v1.1.3\n+EOF\n+test_expect_success 'listing all tags should print them ordered' '\n+\tgit tag v1.0.1 &&\n+\tgit tag t211 &&\n+\tgit tag aa1 &&\n+\tgit tag v0.2.1 &&\n+\tgit tag v1.1.3 &&\n+\tgit tag cba &&\n+\tgit tag a1 &&\n+\tgit tag v1.0 &&\n+\tgit tag t210 &&\n+\tgit tag -l > actual\n+\tgit diff expect actual\n+'\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+cba\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l a > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v0.2.1\n+v1.0.1\n+v1.1.3\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l .1 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+t210\n+t211\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l t21 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+EOF\n+test_expect_success \\\n+\t'listing tags using a name as pattern now must print those matching' '\n+\tgit-tag -l a1 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v1.0\n+v1.0.1\n+EOF\n+test_expect_success \\\n+\t'listing tags using a name as pattern now must print those matching' '\n+\tgit-tag -l v1.0 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v1.1.3\n+EOF\n+test_expect_success \\\n+\t'listing tags with ? in the pattern should print those matching' '\n+\tgit-tag -l 1.1? > actual &&\n+\tgit-diff expect actual\n+'\n+\n+# creating and verifying lightweight tags:\n+\n+test_expect_success \\\n+\t'a non-annotated tag created without parameters should point to HEAD' '\n+\tgit-tag non-annotated-tag &&\n+\t! git cat-file tag non-annotated-tag &&\n+\ttest \"$(git rev-parse non-annotated-tag^{commit})\" = \\\n+\t\t\"$(git rev-parse HEAD)\"\n+'\n+\n+test_expect_failure 'trying to verify an unknown tag should fail' \\\n+\t'git-tag -v unknown-tag'\n+\n+test_expect_failure \\\n+\t'trying to verify a non-annotated and non-signed tag should fail' \\\n+\t'git-tag -v non-annotated-tag'\n+\n+# creating annotated tags:\n+\n+get_tag_msg () {\n+\tgit cat-file tag \"$1\" | sed -n -e \"1,/BEGIN PGP/p\"\n+}\n+\n+get_tag_header () {\n+cat >expect <<EOF\n+object $2\n+type commit\n+tag $1\n+tagger C O Mitter <committer@example.com> $3 -0700\n+\n+EOF\n+}\n+\n+commit=$(git rev-parse HEAD)\n+time=$test_tick\n+\n+get_tag_header annotated-tag $commit $time >expect\n+echo \"A message\" >>expect\n+test_expect_success \\\n+\t'creating an annotated tag with -m message should succeed' '\n+\tgit-tag -m \"A message\" annotated-tag &&\n+\tget_tag_msg annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+cat >msgfile <<EOF\n+Another message\n+in a file.\n+EOF\n+get_tag_header file-annotated-tag $commit $time >expect\n+cat msgfile >>expect\n+test_expect_success \\\n+\t'creating an annotated tag with -F messagefile should succeed' '\n+\tgit-tag -F msgfile file-annotated-tag &&\n+\tget_tag_msg file-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# blank and empty messages:\n+\n+get_tag_header empty-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with an empty -m message should succeed' '\n+\tgit-tag -m \"\" empty-annotated-tag &&\n+\tget_tag_msg empty-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+touch emptyfile\n+get_tag_header emptyfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with an empty -F messagefile should succeed' '\n+\tgit-tag -F emptyfile emptyfile-annotated-tag &&\n+\tget_tag_msg emptyfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '\\n\\n  \\n\\t\\nLeading blank lines\\n' >blanksfile\n+printf '\\n\\t \\t  \\nRepeated blank lines\\n' >>blanksfile\n+printf '\\n\\n\\nTrailing spaces      \\t  \\n' >>blanksfile\n+printf '\\nTrailing blank lines\\n\\n\\t \\n\\n' >>blanksfile\n+get_tag_header blanks-annotated-tag $commit $time >expect\n+cat >>expect <<EOF\n+Leading blank lines\n+\n+Repeated blank lines\n+\n+Trailing spaces\n+\n+Trailing blank lines\n+EOF\n+test_expect_success \\\n+\t'extra blanks in the message for an annotated tag should be removed' '\n+\tgit-tag -F blanksfile blanks-annotated-tag &&\n+\tget_tag_msg blanks-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+get_tag_header blank-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with blank -m message with spaces should succeed' '\n+\tgit-tag -m \"     \" blank-annotated-tag &&\n+\tget_tag_msg blank-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+echo '     ' >blankfile\n+echo ''      >>blankfile\n+echo '  '    >>blankfile\n+get_tag_header blankfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with blank -F messagefile with spaces should succeed' '\n+\tgit-tag -F blankfile blankfile-annotated-tag &&\n+\tget_tag_msg blankfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '      ' >blanknonlfile\n+get_tag_header blanknonlfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with -F file of spaces and no newline should succeed' '\n+\tgit-tag -F blanknonlfile blanknonlfile-annotated-tag &&\n+\tget_tag_msg blanknonlfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# messages with commented lines:\n+\n+cat >commentsfile <<EOF\n+# A comment\n+\n+############\n+The message.\n+############\n+One line.\n+\n+\n+# commented lines\n+# commented lines\n+\n+Another line.\n+# comments\n+\n+Last line.\n+EOF\n+get_tag_header comments-annotated-tag $commit $time >expect\n+cat >>expect <<EOF\n+The message.\n+One line.\n+\n+Another line.\n+\n+Last line.\n+EOF\n+test_expect_success \\\n+\t'creating a tag using a -F messagefile with #comments should succeed' '\n+\tgit-tag -F commentsfile comments-annotated-tag &&\n+\tget_tag_msg comments-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+get_tag_header comment-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with a #comment in the -m message should succeed' '\n+\tgit-tag -m \"#comment\" comment-annotated-tag &&\n+\tget_tag_msg comment-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+echo '#comment' >commentfile\n+echo ''         >>commentfile\n+echo '####'     >>commentfile\n+get_tag_header commentfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with #comments in the -F messagefile should succeed' '\n+\tgit-tag -F commentfile commentfile-annotated-tag &&\n+\tget_tag_msg commentfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '#comment' >commentnonlfile\n+get_tag_header commentnonlfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with a file of #comment and no newline should succeed' '\n+\tgit-tag -F commentnonlfile commentnonlfile-annotated-tag &&\n+\tget_tag_msg commentnonlfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# trying to verify annotated non-signed tags:\n+\n+test_expect_failure \\\n+\t'trying to verify an annotated non-signed tag should fail' '\n+\t! tag_exists annotated-tag ||\n+\tgit-tag -v annotated-tag\n+'\n+\n+test_expect_failure \\\n+\t'trying to verify a file-annotated non-signed tag should fail' '\n+\t! tag_exists file-annotated-tag ||\n+\tgit-tag -v file-annotated-tag\n+'\n+\n+# creating and verifying signed tags:\n+\n+gpg --version >/dev/null\n+if [ $? -eq 127 ]; then\n+\techo \"Skipping signed tags tests, because gpg was not found\"\n+\ttest_done\n+\texit\n+fi\n+\n+# key generation info: gpg --homedir t/t7003 --gen-key\n+# Type DSA and Elgamal, size 2048 bits, no expiration date.\n+# Name and email: C O Mitter <committer@example.com>\n+# No password given, to enable non-interactive operation.\n+\n+cp -R ../t7003 ./gpghome\n+chmod 0700 gpghome\n+export GNUPGHOME=\"$(pwd)/gpghome\"\n+\n+get_tag_header signed-tag $commit $time >expect\n+echo 'A signed tag message' >>expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success 'creating a signed tag with -m message should succeed' '\n+\tgit-tag -s -m \"A signed tag message\" signed-tag &&\n+\tget_tag_msg signed-tag >actual &&\n+\tgit-diff expect actual\n+'\n+\n+test_expect_success 'verifying a signed tag should succeed' \\\n+\t'git-tag -v signed-tag'\n+\n+# blank and empty messages for signed tags:\n+\n+get_tag_header empty-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with an empty -m message should succeed' '\n+\tgit-tag -s -m \"\" empty-signed-tag &&\n+\tget_tag_msg empty-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v empty-signed-tag\n+'\n+\n+touch sigemptyfile\n+get_tag_header emptyfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with an empty -F messagefile should succeed' '\n+\tgit-tag -s -F sigemptyfile emptyfile-signed-tag &&\n+\tget_tag_msg emptyfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v emptyfile-signed-tag\n+'\n+\n+printf '\\n\\n  \\n\\t\\nLeading blank lines\\n' > sigblanksfile\n+printf '\\n\\t \\t  \\nRepeated blank lines\\n' >>sigblanksfile\n+printf '\\n\\n\\nTrailing spaces      \\t  \\n' >>sigblanksfile\n+printf '\\nTrailing blank lines\\n\\n\\t \\n\\n' >>sigblanksfile\n+get_tag_header blanks-signed-tag $commit $time >expect\n+cat >>expect <<EOF\n+Leading blank lines\n+\n+Repeated blank lines\n+\n+Trailing spaces\n+\n+Trailing blank lines\n+EOF\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'extra blanks in the message for a signed tag should be removed' '\n+\tgit-tag -s -F sigblanksfile blanks-signed-tag &&\n+\tget_tag_msg blanks-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blanks-signed-tag\n+'\n+\n+get_tag_header blank-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a blank -m message should succeed' '\n+\tgit-tag -s -m \"     \" blank-signed-tag &&\n+\tget_tag_msg blank-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blank-signed-tag\n+'\n+\n+echo '     ' >sigblankfile\n+echo ''      >>sigblankfile\n+echo '  '    >>sigblankfile\n+get_tag_header blankfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with blank -F file with spaces should succeed' '\n+\tgit-tag -s -F sigblankfile blankfile-signed-tag &&\n+\tget_tag_msg blankfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blankfile-signed-tag\n+'\n+\n+printf '      ' >sigblanknonlfile\n+get_tag_header blanknonlfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with spaces and no newline should succeed' '\n+\tgit-tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&\n+\tget_tag_msg blanknonlfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v signed-tag\n+'\n+\n+# messages with commented lines for signed tags:\n+\n+cat >sigcommentsfile <<EOF\n+# A comment\n+\n+############\n+The message.\n+############\n+One line.\n+\n+\n+# commented lines\n+# commented lines\n+\n+Another line.\n+# comments\n+\n+Last line.\n+EOF\n+get_tag_header comments-signed-tag $commit $time >expect\n+cat >>expect <<EOF\n+The message.\n+One line.\n+\n+Another line.\n+\n+Last line.\n+EOF\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a -F file with #comments should succeed' '\n+\tgit-tag -s -F sigcommentsfile comments-signed-tag &&\n+\tget_tag_msg comments-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v comments-signed-tag\n+'\n+\n+get_tag_header comment-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with #commented -m message should succeed' '\n+\tgit-tag -s -m \"#comment\" comment-signed-tag &&\n+\tget_tag_msg comment-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v comment-signed-tag\n+'\n+\n+echo '#comment' >sigcommentfile\n+echo ''         >>sigcommentfile\n+echo '####'     >>sigcommentfile\n+get_tag_header commentfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with #commented -F messagefile should succeed' '\n+\tgit-tag -s -F sigcommentfile commentfile-signed-tag &&\n+\tget_tag_msg commentfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v commentfile-signed-tag\n+'\n+\n+printf '#comment' >sigcommentnonlfile\n+get_tag_header commentnonlfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a #comment and no newline should succeed' '\n+\tgit-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&\n+\tget_tag_msg commentnonlfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v commentnonlfile-signed-tag\n+'\n+\n+rm -rf gpghome\n+test_expect_failure \\\n+\t'verify signed tag fails when public key is not present' \\\n+\t'git-tag -v signed-tag'\n+\n+test_done\n+\ndiff --git a/t/t7003/pubring.gpg b/t/t7003/pubring.gpg\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..83855fa4e1c6c37afe550c17afa1e7971042ded5\nGIT binary patch\nliteral 1164\nzc$@)@1ateD0ipy(XUi!O1OT%L_{gO;4KKDfwF;#WWYZ2?*>Ph_j9y>uobJf#jXEbw\nzQUOEXs+@;X*)1kyN*7VwW}f-GD3>Vlu2F6j{T^Kt%(kMo(W3C}W^X)NL|0VdGIzc`\nz5@TY!;Du~AFGW=#0vYgS@U2j8Q{Qe9F~lQEBVt+(yjM1jQ{YLe0lxsC<HX~BiFSU3\nzs3oq~QtxsAzbwuV1N{{&PcudMk6}p><?O}^6vikhMm+>LD}W25r?wdKr$(|R8_;Mn\nz&Yh%2Hbu9IX>#(R8S&@jVI!K^K7AI$=A+*-qJ>-J^fdR_m5GZao*%P{nee=O$Eb$s\nzes#O%4Z_4OAZW}8Ey8%%w->rA>z!nf)&NPikkr&pkRlB>=W+x68fwevWl9Ys2R3m2\nzNPf<ig>x1y^AXyemu>Q}DAp%==Q`5sCrBzLaH^rOm1NLtt-ig*IfY?HMdv66@%u%#\nzy0K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5ba=n|GS94<zkje^zT1YFf0ssTLm?$>@\n\nliteral 0\nHc$@<O00001\n\ndiff --git a/t/t7003/random_seed b/t/t7003/random_seed\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..8fed1339ed0a744e5663f4a5e6b6ac9bae3d8524\nGIT binary patch\nliteral 600\nzc$@)P0;m1=h9nBV>1C6QsKJEiEJaD@Q3F8s5u<$E+<2(By)JAZSxviTsXg(wKC+O%\nzzvV{Z>W3*k?r7~pgmmkbw8-x{Am!eeN)z?cwIHcT2jqgiA(SXo<iO=E?cY80`p#w8\nz)O-&?SnwsJ=1VJ-?26&*g88Nr8E=g2onRW^(c+2nJlX)?dmK)tPO0EY-!B!vMCv1)\nz-AOW(3WuF+7IdSxMnzrDgnMqVU=|+YFxlY|VeR+Fg<%C@0Xupi0<S7QYJyFTR$}FQ\nzzoSAbU>CoCKWKX;!3@L_U=aFUm!M<>ILG}$`bfnadAkLQbI-upV7Qwf^OE&N45Pz<\nzk~^KlzNC6)d@QGv=K5-At&A8FS&MQSR`LB}@R1?A3K1p(vM>7CK}EfFhmBJd&cH^-\nz(3Ih^`VuoVBB|w~p!Q^#DY%V2A2FhXu<Bp*L)lSCUdqRyI5wxMG&E1sL$)E$Zo&pJ\nzgy#;fENqHImgN>LL2!7DhfZ}&;BSAyz=T0#S?2+NET5St@16L?YI?5Io%<uD|2}hl\nzx0xsuefz1+bM^-ZIgtKs=)&VAI8(MfytvM>t>%~nsXUb~*EkptHiN?W{=DRu_s;2u\nziHh{2&>;CQO7;>{$DN33_Ef}g+;b<2hIF^p(Y>^riLBb*Y2Xw>F8)jp49&oLKJOic\nz+V{Lt!_`eKGhyk5Edie{-^#n!TFlsfux*QBRZEh^4SVePPmb{BvF|>sKd2cYg@vKp\nmVI8jcB1(k(tlt^Kr<{EMs>|b*d70nyVMQcc%xEnE(#Uq3d^-35\n\nliteral 0\nHc$@<O00001\n\ndiff --git a/t/t7003/secring.gpg b/t/t7003/secring.gpg\nnew file mode 100644\nindex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k259sakI&ta{GOe8x?W>hQIh|%Svs{CO~U>hTXYaE9sQlSv-Y~LWWt4A\nze=w1b1$7Atj3KbAF~092T*!Ogn{R)Lum6n_*@4)N@EjG~z>_B+>GSoQ{oitpmlT^+\nzUAF{c!T4W8?B=H{DVwvgAlJw1n&0jJ00a#P0JLH;8$Wp9`Sv>4USrZ_1sjM0<!q8|\nzxc!{;-PUK5pso<&0dJBFgMNkp@|>Sr>@A%Wd`)WSc+I820A4sJf^=*OHfGjnC8+TD\nzW$<a2;o+X=JkjtG#>Eeh?p*Mr_A}&gvx%r_lw($xcPJ>gap&bv^P|FXJr6fwvQUOh\nzz&W4C8jK4zqM#Z=%N~7K_NKDXEM<K(9uVG9XDN4YijmA{1^}^dq8GAcg)r4N<3^U}\nz-b$q=iUdK8Hdh73UGm8MyfcDWr5~#ja!c&dVahF^v@fRj3IazrWNc@&F~A^V)u*Pi\nz`ugNogkGP(V-|+x+mvq0pc}*Bpq)By!2khN4M6SOU21NKpXW5P=UU_LoDzvrTdR;4\nzU)W&&o9V6>MQOk{A%?1(Ozs{Qqlifa7!d*h2?YX1XUk3k8w>yn2@n&u^&ZXMLk+>~\nz0HDxvfGrJTMY@$ys#k#t?D63Zq=W#R3eUeT(L61`VGHe?zP;`rnta#-umS)8nA%Rq\n\nliteral 0\nHc$@<O00001\n\ndiff --git a/t/t7003/trustdb.gpg b/t/t7003/trustdb.gpg\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..abace962b8bf84be688a6f27e4ebd0ee7052f210\nGIT binary patch\nliteral 1280\nzc${NQFGy!*W@Ke#U|?`dKkdhW9WZj?kU$5c>V~O0xdF0wRNbgLB*4Q^d_AJX`?+Ff\nz-%-DI;cZ{#&fat8WrIk{Bh>LSXg$|u;QP1h(CoKf1uliE9{RiD*MZd?h(R(B0AuhN\nAr2qf`\n\nliteral 0\nHc$@<O00001\n\n-- \n1.5.0\n"},{"id":"45088","messageId":"Pine.LNX.4.64.0706141851160.4059@racer.site","threadId":"8600","inReplyTo":"1b46aba20706140945i2545c06fxce3fda71fe59a7af@mail.gmail.com","subject":"[PATCH] Add test-script for git-tag","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-14T17:58:46Z","receivedAt":"2007-06-14T17:58:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Carlos Rica <jasampler@gmail.com>\n\nThese tests are useful to develop the C version for git-tag.sh,\nensuring that the future builtin-tag.c will not break previous\nbehaviour.\n\nThe tests are focused on listing, verifying, deleting and creating\ntags, checking always that the correct status value is returned\nand everything remains as expected.\n\nIn order to verify and create signed tags, a PGP key was also\nadded, being created this way: gpg --homedir t/t7003 --gen-key\nType DSA and Elgamal, size 2048 bits, no expiration date.\nName and email: C O Mitter <committer@example.com>\nNo password given, to enable non-interactive operation.\n\nSigned-off-by: Carlos Rica <jasampler@gmail.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tGmail had a problem with one line. Thus the resend.\n\n t/t7003-tag.sh      |  616 +++++++++++++++++++++++++++++++++++++++++++++++++++\n t/t7003/pubring.gpg |  Bin 0 -> 1164 bytes\n t/t7003/random_seed |  Bin 0 -> 600 bytes\n t/t7003/secring.gpg |  Bin 0 -> 1237 bytes\n t/t7003/trustdb.gpg |  Bin 0 -> 1280 bytes\n 5 files changed, 616 insertions(+), 0 deletions(-)\n create mode 100755 t/t7003-tag.sh\n create mode 100644 t/t7003/pubring.gpg\n create mode 100644 t/t7003/random_seed\n create mode 100644 t/t7003/secring.gpg\n create mode 100644 t/t7003/trustdb.gpg\n\ndiff --git a/t/t7003-tag.sh b/t/t7003-tag.sh\nnew file mode 100755\nindex 0000000..d998dd2\n--- /dev/null\n+++ b/t/t7003-tag.sh\n@@ -0,0 +1,616 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Carlos Rica\n+#\n+\n+test_description='git-tag\n+\n+Basic tests for operations with tags.'\n+\n+. ./test-lib.sh\n+\n+# creating and listing lightweight tags:\n+\n+tag_exists () {\n+\tgit show-ref --quiet --verify refs/tags/$1\n+}\n+\n+test_expect_success 'listing all tags in an empty tree now should succeed' \\\n+\t'git tag -l'\n+\n+test_expect_success 'listing all tags in an empty tree should output nothing' \\\n+\t'test `git-tag -l | wc -l` -eq 0'\n+\n+test_expect_failure 'looking for a tag in an empty tree should fail' \\\n+\t'tag_exists mytag'\n+\n+test_expect_failure 'creating a tag in an empty tree should fail' '\n+\tgit-tag mynotag ||\n+\ttag_exists mynotag\n+'\n+\n+test_expect_failure 'creating a tag for HEAD in an empty tree should fail' '\n+\tgit-tag mytaghead HEAD ||\n+\ttag_exists mytaghead\n+'\n+\n+test_expect_failure 'creating a tag for an unknown revision should fail' '\n+\tgit-tag mytagnorev aaaaaaaaaaa ||\n+\ttag_exists mytagnorev\n+'\n+\n+test_expect_success 'creating a tag using default HEAD should succeed' '\n+\techo foo >foo &&\n+\tgit add foo &&\n+\ttest_tick && git commit -m Foo &&\n+\tgit tag mytag\n+'\n+\n+test_expect_success 'listing all tags if one exists now also should succeed' \\\n+\t'git-tag -l'\n+\n+test_expect_success 'listing all tags if one exists should output that tag' \\\n+\t'test `git-tag -l` = mytag'\n+\n+# pattern matching:\n+\n+test_expect_success 'listing a tag using a matching pattern should succeed' \\\n+\t'git-tag -l mytag'\n+\n+test_expect_success \\\n+\t'listing a tag using a matching pattern should output that tag' \\\n+\t'test `git-tag -l mytag` = mytag'\n+\n+test_expect_success \\\n+\t'listing tags using a non-matching pattern now should suceed' \\\n+\t'git-tag -l xxx'\n+\n+test_expect_success \\\n+\t'listing tags using a non-matching pattern should output nothing' \\\n+\t'test `git-tag -l xxx | wc -l` -eq 0'\n+\n+# special cases for creating tags:\n+\n+test_expect_failure \\\n+\t'trying to create a tag with the name of one existing should fail' \\\n+\t'git tag mytag'\n+\n+test_expect_failure 'trying to create a tag with a non-valid name should fail' '\n+\ttest `git-tag -l | wc -l` -ne 1 ||\n+\tgit tag .othertag ||\n+\tgit tag \"other tag\" ||\n+\tgit tag \"othertag^\" ||\n+\tgit tag \"other~tag\" ||\n+\ttest `git-tag -l | wc -l` -ne 1\n+'\n+\n+test_expect_success 'creating a tag using HEAD directly should succeed' '\n+\tgit tag myhead HEAD &&\n+\ttag_exists myhead\n+'\n+\n+# deleting tags:\n+\n+test_expect_failure 'trying to delete an unknown tag should fail' '\n+\ttag_exists unknown-tag ||\n+\tgit-tag -d unknown-tag\n+'\n+\n+cat >expect <<EOF\n+myhead\n+mytag\n+EOF\n+test_expect_success \\\n+\t'trying to delete tags without params should succeed and do nothing' '\n+\tgit tag -l > actual && git diff expect actual &&\n+\tgit-tag -d &&\n+\tgit tag -l > actual && git diff expect actual\n+'\n+\n+test_expect_success \\\n+\t'deleting two existing tags in one command should succeed' '\n+\ttag_exists mytag &&\n+\ttag_exists myhead &&\n+\tgit-tag -d mytag myhead &&\n+\t! tag_exists mytag &&\n+\t! tag_exists myhead\n+'\n+\n+test_expect_success \\\n+\t'creating a tag with the name of another deleted one should succeed' '\n+\t! tag_exists mytag &&\n+\tgit-tag mytag &&\n+\ttag_exists mytag\n+'\n+\n+test_expect_failure \\\n+\t'trying to delete two tags -existing and not- should fail for the 2nd' '\n+\ttag_exists mytag &&\n+\t! tag_exists myhead &&\n+\tgit-tag -d mytag anothertag\n+\t! tag_exists mytag &&\n+\t! tag_exists myhead &&\n+'\n+\n+test_expect_failure 'trying to delete an already deleted tag should fail' \\\n+\t'git-tag -d mytag'\n+\n+# listing various tags with pattern matching:\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+cba\n+t210\n+t211\n+v0.2.1\n+v1.0\n+v1.0.1\n+v1.1.3\n+EOF\n+test_expect_success 'listing all tags should print them ordered' '\n+\tgit tag v1.0.1 &&\n+\tgit tag t211 &&\n+\tgit tag aa1 &&\n+\tgit tag v0.2.1 &&\n+\tgit tag v1.1.3 &&\n+\tgit tag cba &&\n+\tgit tag a1 &&\n+\tgit tag v1.0 &&\n+\tgit tag t210 &&\n+\tgit tag -l > actual\n+\tgit diff expect actual\n+'\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+cba\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l a > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v0.2.1\n+v1.0.1\n+v1.1.3\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l .1 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+t210\n+t211\n+EOF\n+test_expect_success \\\n+\t'listing tags with substring as pattern now must print those matching' '\n+\tgit-tag -l t21 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+a1\n+aa1\n+EOF\n+test_expect_success \\\n+\t'listing tags using a name as pattern now must print those matching' '\n+\tgit-tag -l a1 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v1.0\n+v1.0.1\n+EOF\n+test_expect_success \\\n+\t'listing tags using a name as pattern now must print those matching' '\n+\tgit-tag -l v1.0 > actual &&\n+\tgit-diff expect actual\n+'\n+\n+cat >expect <<EOF\n+v1.1.3\n+EOF\n+test_expect_success \\\n+\t'listing tags with ? in the pattern should print those matching' '\n+\tgit-tag -l 1.1? > actual &&\n+\tgit-diff expect actual\n+'\n+\n+# creating and verifying lightweight tags:\n+\n+test_expect_success \\\n+\t'a non-annotated tag created without parameters should point to HEAD' '\n+\tgit-tag non-annotated-tag &&\n+\t! git cat-file tag non-annotated-tag &&\n+\ttest \"$(git rev-parse non-annotated-tag^{commit})\" = \\\n+\t\t\"$(git rev-parse HEAD)\"\n+'\n+\n+test_expect_failure 'trying to verify an unknown tag should fail' \\\n+\t'git-tag -v unknown-tag'\n+\n+test_expect_failure \\\n+\t'trying to verify a non-annotated and non-signed tag should fail' \\\n+\t'git-tag -v non-annotated-tag'\n+\n+# creating annotated tags:\n+\n+get_tag_msg () {\n+\tgit cat-file tag \"$1\" | sed -n -e \"1,/BEGIN PGP/p\"\n+}\n+\n+get_tag_header () {\n+cat >expect <<EOF\n+object $2\n+type commit\n+tag $1\n+tagger C O Mitter <committer@example.com> $3 -0700\n+\n+EOF\n+}\n+\n+commit=$(git rev-parse HEAD)\n+time=$test_tick\n+\n+get_tag_header annotated-tag $commit $time >expect\n+echo \"A message\" >>expect\n+test_expect_success \\\n+\t'creating an annotated tag with -m message should succeed' '\n+\tgit-tag -m \"A message\" annotated-tag &&\n+\tget_tag_msg annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+cat >msgfile <<EOF\n+Another message\n+in a file.\n+EOF\n+get_tag_header file-annotated-tag $commit $time >expect\n+cat msgfile >>expect\n+test_expect_success \\\n+\t'creating an annotated tag with -F messagefile should succeed' '\n+\tgit-tag -F msgfile file-annotated-tag &&\n+\tget_tag_msg file-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# blank and empty messages:\n+\n+get_tag_header empty-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with an empty -m message should succeed' '\n+\tgit-tag -m \"\" empty-annotated-tag &&\n+\tget_tag_msg empty-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+touch emptyfile\n+get_tag_header emptyfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with an empty -F messagefile should succeed' '\n+\tgit-tag -F emptyfile emptyfile-annotated-tag &&\n+\tget_tag_msg emptyfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '\\n\\n  \\n\\t\\nLeading blank lines\\n' >blanksfile\n+printf '\\n\\t \\t  \\nRepeated blank lines\\n' >>blanksfile\n+printf '\\n\\n\\nTrailing spaces      \\t  \\n' >>blanksfile\n+printf '\\nTrailing blank lines\\n\\n\\t \\n\\n' >>blanksfile\n+get_tag_header blanks-annotated-tag $commit $time >expect\n+cat >>expect <<EOF\n+Leading blank lines\n+\n+Repeated blank lines\n+\n+Trailing spaces\n+\n+Trailing blank lines\n+EOF\n+test_expect_success \\\n+\t'extra blanks in the message for an annotated tag should be removed' '\n+\tgit-tag -F blanksfile blanks-annotated-tag &&\n+\tget_tag_msg blanks-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+get_tag_header blank-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with blank -m message with spaces should succeed' '\n+\tgit-tag -m \"     \" blank-annotated-tag &&\n+\tget_tag_msg blank-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+echo '     ' >blankfile\n+echo ''      >>blankfile\n+echo '  '    >>blankfile\n+get_tag_header blankfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with blank -F messagefile with spaces should succeed' '\n+\tgit-tag -F blankfile blankfile-annotated-tag &&\n+\tget_tag_msg blankfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '      ' >blanknonlfile\n+get_tag_header blanknonlfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with -F file of spaces and no newline should succeed' '\n+\tgit-tag -F blanknonlfile blanknonlfile-annotated-tag &&\n+\tget_tag_msg blanknonlfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# messages with commented lines:\n+\n+cat >commentsfile <<EOF\n+# A comment\n+\n+############\n+The message.\n+############\n+One line.\n+\n+\n+# commented lines\n+# commented lines\n+\n+Another line.\n+# comments\n+\n+Last line.\n+EOF\n+get_tag_header comments-annotated-tag $commit $time >expect\n+cat >>expect <<EOF\n+The message.\n+One line.\n+\n+Another line.\n+\n+Last line.\n+EOF\n+test_expect_success \\\n+\t'creating a tag using a -F messagefile with #comments should succeed' '\n+\tgit-tag -F commentsfile comments-annotated-tag &&\n+\tget_tag_msg comments-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+get_tag_header comment-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with a #comment in the -m message should succeed' '\n+\tgit-tag -m \"#comment\" comment-annotated-tag &&\n+\tget_tag_msg comment-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+echo '#comment' >commentfile\n+echo ''         >>commentfile\n+echo '####'     >>commentfile\n+get_tag_header commentfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with #comments in the -F messagefile should succeed' '\n+\tgit-tag -F commentfile commentfile-annotated-tag &&\n+\tget_tag_msg commentfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+printf '#comment' >commentnonlfile\n+get_tag_header commentnonlfile-annotated-tag $commit $time >expect\n+test_expect_success \\\n+\t'creating a tag with a file of #comment and no newline should succeed' '\n+\tgit-tag -F commentnonlfile commentnonlfile-annotated-tag &&\n+\tget_tag_msg commentnonlfile-annotated-tag >actual &&\n+\tgit diff expect actual\n+'\n+\n+# trying to verify annotated non-signed tags:\n+\n+test_expect_failure \\\n+\t'trying to verify an annotated non-signed tag should fail' '\n+\t! tag_exists annotated-tag ||\n+\tgit-tag -v annotated-tag\n+'\n+\n+test_expect_failure \\\n+\t'trying to verify a file-annotated non-signed tag should fail' '\n+\t! tag_exists file-annotated-tag ||\n+\tgit-tag -v file-annotated-tag\n+'\n+\n+# creating and verifying signed tags:\n+\n+gpg --version >/dev/null\n+if [ $? -eq 127 ]; then\n+\techo \"Skipping signed tags tests, because gpg was not found\"\n+\ttest_done\n+\texit\n+fi\n+\n+# key generation info: gpg --homedir t/t7003 --gen-key\n+# Type DSA and Elgamal, size 2048 bits, no expiration date.\n+# Name and email: C O Mitter <committer@example.com>\n+# No password given, to enable non-interactive operation.\n+\n+cp -R ../t7003 ./gpghome\n+chmod 0700 gpghome\n+export GNUPGHOME=\"$(pwd)/gpghome\"\n+\n+get_tag_header signed-tag $commit $time >expect\n+echo 'A signed tag message' >>expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success 'creating a signed tag with -m message should succeed' '\n+\tgit-tag -s -m \"A signed tag message\" signed-tag &&\n+\tget_tag_msg signed-tag >actual &&\n+\tgit-diff expect actual\n+'\n+\n+test_expect_success 'verifying a signed tag should succeed' \\\n+\t'git-tag -v signed-tag'\n+\n+# blank and empty messages for signed tags:\n+\n+get_tag_header empty-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with an empty -m message should succeed' '\n+\tgit-tag -s -m \"\" empty-signed-tag &&\n+\tget_tag_msg empty-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v empty-signed-tag\n+'\n+\n+touch sigemptyfile\n+get_tag_header emptyfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with an empty -F messagefile should succeed' '\n+\tgit-tag -s -F sigemptyfile emptyfile-signed-tag &&\n+\tget_tag_msg emptyfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v emptyfile-signed-tag\n+'\n+\n+printf '\\n\\n  \\n\\t\\nLeading blank lines\\n' > sigblanksfile\n+printf '\\n\\t \\t  \\nRepeated blank lines\\n' >>sigblanksfile\n+printf '\\n\\n\\nTrailing spaces      \\t  \\n' >>sigblanksfile\n+printf '\\nTrailing blank lines\\n\\n\\t \\n\\n' >>sigblanksfile\n+get_tag_header blanks-signed-tag $commit $time >expect\n+cat >>expect <<EOF\n+Leading blank lines\n+\n+Repeated blank lines\n+\n+Trailing spaces\n+\n+Trailing blank lines\n+EOF\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'extra blanks in the message for a signed tag should be removed' '\n+\tgit-tag -s -F sigblanksfile blanks-signed-tag &&\n+\tget_tag_msg blanks-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blanks-signed-tag\n+'\n+\n+get_tag_header blank-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a blank -m message should succeed' '\n+\tgit-tag -s -m \"     \" blank-signed-tag &&\n+\tget_tag_msg blank-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blank-signed-tag\n+'\n+\n+echo '     ' >sigblankfile\n+echo ''      >>sigblankfile\n+echo '  '    >>sigblankfile\n+get_tag_header blankfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with blank -F file with spaces should succeed' '\n+\tgit-tag -s -F sigblankfile blankfile-signed-tag &&\n+\tget_tag_msg blankfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v blankfile-signed-tag\n+'\n+\n+printf '      ' >sigblanknonlfile\n+get_tag_header blanknonlfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with spaces and no newline should succeed' '\n+\tgit-tag -s -F sigblanknonlfile blanknonlfile-signed-tag &&\n+\tget_tag_msg blanknonlfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v signed-tag\n+'\n+\n+# messages with commented lines for signed tags:\n+\n+cat >sigcommentsfile <<EOF\n+# A comment\n+\n+############\n+The message.\n+############\n+One line.\n+\n+\n+# commented lines\n+# commented lines\n+\n+Another line.\n+# comments\n+\n+Last line.\n+EOF\n+get_tag_header comments-signed-tag $commit $time >expect\n+cat >>expect <<EOF\n+The message.\n+One line.\n+\n+Another line.\n+\n+Last line.\n+EOF\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a -F file with #comments should succeed' '\n+\tgit-tag -s -F sigcommentsfile comments-signed-tag &&\n+\tget_tag_msg comments-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v comments-signed-tag\n+'\n+\n+get_tag_header comment-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with #commented -m message should succeed' '\n+\tgit-tag -s -m \"#comment\" comment-signed-tag &&\n+\tget_tag_msg comment-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v comment-signed-tag\n+'\n+\n+echo '#comment' >sigcommentfile\n+echo ''         >>sigcommentfile\n+echo '####'     >>sigcommentfile\n+get_tag_header commentfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with #commented -F messagefile should succeed' '\n+\tgit-tag -s -F sigcommentfile commentfile-signed-tag &&\n+\tget_tag_msg commentfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v commentfile-signed-tag\n+'\n+\n+printf '#comment' >sigcommentnonlfile\n+get_tag_header commentnonlfile-signed-tag $commit $time >expect\n+echo '-----BEGIN PGP SIGNATURE-----' >>expect\n+test_expect_success \\\n+\t'creating a signed tag with a #comment and no newline should succeed' '\n+\tgit-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag &&\n+\tget_tag_msg commentnonlfile-signed-tag >actual &&\n+\tgit diff expect actual &&\n+\tgit-tag -v commentnonlfile-signed-tag\n+'\n+\n+rm -rf gpghome\n+test_expect_failure \\\n+\t'verify signed tag fails when public key is not present' \\\n+\t'git-tag -v signed-tag'\n+\n+test_done\n+\ndiff --git a/t/t7003/pubring.gpg b/t/t7003/pubring.gpg\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..83855fa4e1c6c37afe550c17afa1e7971042ded5\nGIT binary patch\nliteral 1164\nzcmV;71ateD0ipy(XUi!O1OT%L_{gO;4KKDfwF;#WWYZ2?*>Ph_j9y>uobJf#jXEbw\nzQUOEXs+@;X*)1kyN*7VwW}f-GD3>Vlu2F6j{T^Kt%(kMo(W3C}W^X)NL|0VdGIzc`\nz5@TY!;Du~AFGW=#0vYgS@U2j8Q{Qe9F~lQEBVt+(yjM1jQ{YLe0lxsC<HX~BiFSU3\nzs3oq~QtxsAzbwuV1N{{&P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5P=-vvIiJTGj0-lRpc+EU9(`B#rn1m1WqmXr\nz5Z+N|DR*y*k<4fY0I_eP7qVo9Fx58WMwaK^N~I=>1VN29R|Umg^2q$WGlE#9AFC2_\nzOYG5M$}OL?FQ)ej0!KGwY-hAFz#wAPr>3&{`s7!HUZ22Y7KY{9ly1wQ8^hqBojPv8\nzh)Dz(5dr`S1p-EA%T59t3;+rV5EHib9?jlE4Z-XHpqd%~B34SUmtRi+{;vv2ei?p%\neLjau^#pu5ba=n|GS94<zkje^zT1YFf0ssTLm?$>@\n\nliteral 0\nHcmV?d00001\n\ndiff --git a/t/t7003/random_seed b/t/t7003/random_seed\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..8fed1339ed0a744e5663f4a5e6b6ac9bae3d8524\nGIT binary patch\nliteral 600\nzcmV-e0;m1=h9nBV>1C6QsKJEiEJaD@Q3F8s5u<$E+<2(By)JAZSxviTsXg(wKC+O%\nzzvV{Z>W3*k?r7~pgmmkbw8-x{Am!eeN)z?cwIHcT2jqgiA(SXo<iO=E?cY80`p#w8\nz)O-&?SnwsJ=1VJ-?26&*g88Nr8E=g2onRW^(c+2nJlX)?dmK)tPO0EY-!B!vMCv1)\nz-AOW(3WuF+7IdSxMnzrDgnMqVU=|+YFxlY|VeR+Fg<%C@0Xupi0<S7QYJyFTR$}FQ\nzzoSAbU>CoCKWKX;!3@L_U=aFUm!M<>ILG}$`bfnadAkLQbI-upV7Qwf^OE&N45Pz<\nzk~^KlzNC6)d@QGv=K5-At&A8FS&MQSR`LB}@R1?A3K1p(vM>7CK}EfFhmBJd&cH^-\nz(3Ih^`VuoVBB|w~p!Q^#DY%V2A2FhXu<Bp*L)lSCUdqRyI5wxMG&E1sL$)E$Zo&pJ\nzgy#;fENqHImgN>LL2!7DhfZ}&;BSAyz=T0#S?2+NET5St@16L?YI?5Io%<uD|2}hl\nzx0xsuefz1+bM^-ZIgtKs=)&VAI8(MfytvM>t>%~nsXUb~*EkptHiN?W{=DRu_s;2u\nziHh{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7052f210\nGIT binary patch\nliteral 1280\nzcmZQfFGy!*W@Ke#U|?`dKkWykumMIcY@%4iM%7^n6rj+M4;MLzzlOX&pwTnxkD-}P\nzc^HbXN0fL!SIq1?>env3?W^3`d(OOU5YNaX{KU(k^<0;M@87ONv)_6ZxD={-=<kYO\nM2Ud3=2BC}r0AuhNr2qf`\n\nliteral 0\nHcmV?d00001\n\n-- \n1.5.2.1.2876.g6670-dirty\n"},{"id":"45158","messageId":"7vy7ik4h13.fsf@assigned-by-dhcp.pobox.com","threadId":"8600","inReplyTo":"Pine.LNX.4.64.0706141851160.4059@racer.site","subject":"Re: [PATCH] Add test-script for git-tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-16T05:14:48Z","receivedAt":"2007-06-16T05:14:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> forwarded:\n\n> +# creating and listing lightweight tags:\n> +\n> +tag_exists () {\n> +\tgit show-ref --quiet --verify refs/tags/$1\n> +}\n\nIt would be better if you _always_ quoted \"$1\" for my eyes, as\nit would let my brain coast over it without thinking.  This does\nnot matter in practice as we do not allow metacharacters nor\nwhitespaces in tagnames, but that comes _after_ having to think\nabout it.\n\n> +test_expect_success 'listing all tags in an empty tree now should succeed' \\\n> +\t'git tag -l'\n\nA recent patch made it not to exit with non-zero, but I think\nthat is probably a bug we might want to fix.\n\n> +test_expect_success \\\n> +\t'listing a tag using a matching pattern should output that tag' \\\n> +\t'test `git-tag -l mytag` = mytag'\n> +\n> +test_expect_success \\\n> +\t'listing tags using a non-matching pattern now should suceed' \\\n> +\t'git-tag -l xxx'\n> +\n> +test_expect_success \\\n> +\t'listing tags using a non-matching pattern should output nothing' \\\n> +\t'test `git-tag -l xxx | wc -l` -eq 0'\n> +\n\nAdditional test would be to see git-tag -l \"my*\" should succeed,\nand git-tag -l \"my.*\" should fail, as the pattern should match\nwith fnmatch() not regexp().\n\n> +# special cases for creating tags:\n> +\n> +test_expect_failure \\\n> +\t'trying to create a tag with the name of one existing should fail' \\\n> +\t'git tag mytag'\n> +\n> +test_expect_failure 'trying to create a tag with a non-valid name should fail' '\n> +\ttest `git-tag -l | wc -l` -ne 1 ||\n> +\tgit tag .othertag ||\n> +\tgit tag \"other tag\" ||\n> +\tgit tag \"othertag^\" ||\n> +\tgit tag \"other~tag\" ||\n> +\ttest `git-tag -l | wc -l` -ne 1\n> +'\n\nWhile it is logically correct to string error conditions with ||\nand test inside expect-failure (you are saying \"it is a failure\nif any of these succeeds\"), it needs a bit of brain-twisting to\nget what is going on.  But I think this is a valid way to use\nexpect-failure.\n\n> +test_expect_success \\\n> +\t'listing tags with substring as pattern now must print those matching' '\n> ...\n> +test_expect_success \\\n> +\t'listing tags with substring as pattern now must print those matching' '\n> ...\n> +test_expect_success \\\n> +\t'listing tags with substring as pattern now must print those matching' '\n> ...\n> +test_expect_success \\\n> +\t'listing tags using a name as pattern now must print those matching' '\n> ...\n> +test_expect_success \\\n> +\t'listing tags using a name as pattern now must print those matching' '\n> ...\n\nSomehow, \"now\" gets quite irritating.\n\n> +\n> +cat >expect <<EOF\n> +v1.1.3\n> +EOF\n> +test_expect_success \\\n> +\t'listing tags with ? in the pattern should print those matching' '\n> +\tgit-tag -l 1.1? > actual &&\n> +\tgit-diff expect actual\n> +'\n\nI know that there is no such file as 1.1X in the working tree,\nbut I would feel better if the test protected the ? from the\nshell, as in \"git tag -l 1.1\\? >actual\".\n\n> +# creating and verifying lightweight tags:\n> +\n> +test_expect_success \\\n> +\t'a non-annotated tag created without parameters should point to HEAD' '\n> +\tgit-tag non-annotated-tag &&\n> +\t! git cat-file tag non-annotated-tag &&\n> +\ttest \"$(git rev-parse non-annotated-tag^{commit})\" = \\\n> +\t\t\"$(git rev-parse HEAD)\"\n> +'\n\nI think testing the type directly is more to the point, as in\n\n\ttest $(git-cat-file -t non-annotated-tag) = commit &&\n        test $(git-rev-parse non-annotated-tag) = $(git-rev-parse HEAD)\n\n> +\n> +test_expect_failure 'trying to verify an unknown tag should fail' \\\n> +\t'git-tag -v unknown-tag'\n> +\n> +test_expect_failure \\\n> +\t'trying to verify a non-annotated and non-signed tag should fail' \\\n> +\t'git-tag -v non-annotated-tag'\n> +\n> +# creating annotated tags:\n> +\n> +get_tag_msg () {\n> +\tgit cat-file tag \"$1\" | sed -n -e \"1,/BEGIN PGP/p\"\n> +}\n> +\n\nI would write that as \"sed -e '/BEGIN PGP/q'\", shorter and more\nto the point.\n\n> +get_tag_header () {\n> +cat >expect <<EOF\n> +object $2\n> +type commit\n> +tag $1\n> +tagger C O Mitter <committer@example.com> $3 -0700\n> +\n> +EOF\n> +}\n\nMaybe -0700 deserves a comment --- test_tick always gives time\nin that timezone.\n\nYou probably would want to also test annotated tags on non\ncommits (i.e. trees, blobs and tags).\n\n> +\n> +commit=$(git rev-parse HEAD)\n> +time=$test_tick\n> +\n> +get_tag_header annotated-tag $commit $time >expect\n\nHuh? get_tag_header stores into \"expect\" file without saying\nanything itself, and you redirect that nothingless to the same\nfile?\n\n> +touch emptyfile\n\nMaybe it's just me being old-fashioned, but I prefer creation of\nan empty file be done with:\n\n\t: >emptyfile\nor just\n\n\t>emptyfile\n\nand avoid using \"touch\".  Some broken systems did not create a\nnew file with \"touch non-existing-file\" (I think it was old AIX).\n\n> +# creating and verifying signed tags:\n> +\n> +gpg --version >/dev/null\n> +if [ $? -eq 127 ]; then\n> +\techo \"Skipping signed tags tests, because gpg was not found\"\n> +\ttest_done\n> +\texit\n> +fi\n> +\n> +# key generation info: gpg --homedir t/t7003 --gen-key\n> +# Type DSA and Elgamal, size 2048 bits, no expiration date.\n> +# Name and email: C O Mitter <committer@example.com>\n> +# No password given, to enable non-interactive operation.\n> +\n> +cp -R ../t7003 ./gpghome\n> +chmod 0700 gpghome\n> +export GNUPGHOME=\"$(pwd)/gpghome\"\n> +\n> +get_tag_header signed-tag $commit $time >expect\n> +echo 'A signed tag message' >>expect\n> +echo '-----BEGIN PGP SIGNATURE-----' >>expect\n> +test_expect_success 'creating a signed tag with -m message should succeed' '\n> +\tgit-tag -s -m \"A signed tag message\" signed-tag &&\n> +\tget_tag_msg signed-tag >actual &&\n> +\tgit-diff expect actual\n> +'\n> +\n\nThis is just me being curious, but I wonder if this test is safe\nto run on an otherwise idle server without moving parts and\nkeyboard (i.e. lack of sufficient entropy).  I think you made a\nprudent choice of not generating a test key in the test script,\nby the way.\n\n> +test_expect_success 'verifying a signed tag should succeed' \\\n> +\t'git-tag -v signed-tag'\n> +\n\nForging the tag at this point and make sure it does not verify\nwould also be interesting, as in:\n\n\tforged=$(git cat-file tag signed-tag |\n\t\tsed -e \"s/signed-tag/forged-tag/\" |\n\t\tgit mktag) &&\n\tgit tag forged-tag $forged &&\n        if git-tag -v forged-tag\n        then\n        \techo Oops\n\t\tfalse\n\telse\n        \t: happy\n\tfi\n\n> diff --git a/t/t7003/random_seed b/t/t7003/random_seed\n> new file mode 100644\n> index 0000000000000000000000000000000000000000..8fed1339ed0a744e5663f4a5e6b6ac9bae3d8524\n> GIT binary patch\n> literal 600\n> zcmV-e0;m1=h9nBV>1C6QsKJEiEJaD@Q3F8s5u<$E+<2(By)JAZSxviTsXg(wKC+O%\n> zzvV{Z>W3*k?r7~pgmmkbw8-x{Am!eeN)z?cwIHcT2jqgiA(SXo<iO=E?cY80`p#w8\n\nIs it necessary to ship random_seed, or is it created as needed\nduring the test?\n"}]}