git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7004: test that "git-tag -u" implies "-s"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 11, 2007, 04:38 UTC
Message-ID
<7v63z5j16g.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071211042436.GA23805@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Looks good to me, and here's a test. It was trivial to whip up, since I
> wrote a test for almost the identical bug a few days ago (that one was
> "-s implies -a").

Looks good to me. We should verify both common forms of key-id and also check a negative case. This squashes a few of mine on top of yours.

---
 t/t7004-tag.sh |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index c7130c4..a502286 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -640,6 +640,32 @@ test_expect_success 'creating a signed tag with -m message should succeed' '
 	git diff expect actual
 '
 
+get_tag_header implied-sign $commit commit $time >expect
+echo 'Another signed tag' >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success '-u implies signed tag' '
+	git-tag -u CDDE430D -m "Another signed tag" implied-sign &&
+	get_tag_msg implied-sign >actual &&
+	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' '
+
+	! git tag -u author@example.com -m "Another message" o-signed-tag
+
+'
+
 cat >sigmsgfile <<EOF
 Another signed tag
 message in a file.
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “"git tag -u keyname" broken”
  1. Linus TorvaldsDec 11, 2007
  2. t7004: test that "git-tag -u" implies "-s"Jeff King, Dec 11, 2007
  3. Junio C HamanoDec 11, 2007
  4. Jeff KingDec 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.