git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git tag -u keyname" broken
@ 2007-12-11  4:08 Linus Torvalds
  2007-12-11  4:24 ` [PATCH] t7004: test that "git-tag -u" implies "-s" Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2007-12-11  4:08 UTC (permalink / raw)
  To: Junio C Hamano, Carlos Rica, Git Mailing List


Commit 396865859918e9c7bf8ce74aae137c57da134610 broke signed tags using 
the "-u" flag when it made builtin-tag.c use parse_options() to parse its
arguments (but it quite possibly was broken even before that, by the 
builtin rewrite).

It used to be that passing the signing ID with the -u parameter also 
(obviously!) implied that you wanted to sign and annotate the tag, but 
that logic got dropped. It also totally ignored the actual key ID that was 
passed in.

This reinstates it all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

This has gotten only very minimal testing. Somebody should double-check it 
all, and adding a test would probably be great too.

 builtin-tag.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/builtin-tag.c b/builtin-tag.c
index 517419f..274901a 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -236,14 +236,18 @@ static const char tag_template[] =
 	"# Write a tag message\n"
 	"#\n";
 
+static void set_signingkey(const char *value)
+{
+	if (strlcpy(signingkey, value, sizeof(signingkey)) >= sizeof(signingkey))
+		die("signing key value too long (%.10s...)", value);
+}
+
 static int git_tag_config(const char *var, const char *value)
 {
 	if (!strcmp(var, "user.signingkey")) {
 		if (!value)
 			die("user.signingkey without value");
-		if (strlcpy(signingkey, value, sizeof(signingkey))
-						>= sizeof(signingkey))
-			die("user.signingkey value too long");
+		set_signingkey(value);
 		return 0;
 	}
 
@@ -396,6 +400,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
 	argc = parse_options(argc, argv, options, git_tag_usage, 0);
 
+	if (keyid) {
+		sign = 1;
+		set_signingkey(keyid);
+	}
 	if (sign)
 		annotate = 1;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-11  5:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11  4:08 "git tag -u keyname" broken Linus Torvalds
2007-12-11  4:24 ` [PATCH] t7004: test that "git-tag -u" implies "-s" Jeff King
2007-12-11  4:38   ` Junio C Hamano
2007-12-11  5:22     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).