git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@osdl.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <junkio@cox.net>,
	ftpadmin@kernel.org
Subject: Re: Tags
Date: Wed, 06 Jul 2005 21:31:18 -0600	[thread overview]
Message-ID: <m13bqrwaux.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0507051132530.3570@g5.osdl.org> (Linus Torvalds's message of "Tue, 5 Jul 2005 11:33:52 -0700 (PDT)")

Linus Torvalds <torvalds@osdl.org> writes:

> On Tue, 5 Jul 2005, Eric W. Biederman wrote:
>> 
>> True but if you can you will get multiple tags with the
>> same suggested name.  So you need so way to find the one you
>> care about.
>
> I do agree that it would make sense to have a "tagger" field with the same 
> semantics as the "committer" in a commit (including all the same fields: 
> real name, email, and date).

Ok here is a patch that implements it.

I don't know how robust my code to get the defaults of tagger
email address and especially tagger name are but basically it
works.

In addition I added a message when git-tag-script is waiting
for you to type the tag message so people aren't confused.

And of course I modified git-mktag to check that the tagger
field is present.

Now git-pull-script just needs to be tweaked to optionally
add tags in the update into .git/refs/tags :)   Using git-fsck-cache
to find tags is doable but it slows down as your archive grows.

Eric


diff --git a/date.c b/date.c
diff --git a/git-tag-script b/git-tag-script
--- a/git-tag-script
+++ b/git-tag-script
@@ -1,12 +1,30 @@
 #!/bin/sh
 # Copyright (c) 2005 Linus Torvalds
 
+usage() {
+	echo 'git tag <tag name> [<sha1>]'
+	exit 1
+}
+
 : ${GIT_DIR=.git}
+if [ ! -d "$GIT_DIR" ]; then
+	echo Not a git directory 1>&2
+	exit 1
+fi
+
+if [ $# -gt 2 -o $# -lt 1 ]; then
+	usage
+fi
 
 object=${2:-$(cat "$GIT_DIR"/HEAD)}
 type=$(git-cat-file -t $object) || exit 1
-( echo -e "object $object\ntype $type\ntag $1\n"; cat ) > .tmp-tag
+tagger_name=${GIT_COMMITTER_NAME:-$(sed -n -e "s/^$(whoami):[^:]*:[^:]*:[^:]*:\([^:,]*\).*:.*$/\1/p" <  /etc/passwd)}
+tagger_email=${GIT_COMMITTER_EMAIL:-"$(whoami)@$(hostname --fqdn)"}
+tagger_date=$(date -d "${GIT_COMMITTER_DATE:-$(date -R)}" +"%s %z") || exit 1
+echo "Enter tag message now. ^D when finished"
+( echo -e "object $object\ntype $type\ntag $1\ntagger $tagger_name <$tagger_email> $tagger_date\n"; cat) > .tmp-tag
 rm -f .tmp-tag.asc
 gpg -bsa .tmp-tag && cat .tmp-tag.asc >> .tmp-tag
-git-mktag < .tmp-tag
-#rm .tmp-tag .tmp-tag.sig
+exit 1
+./git-mktag < .tmp-tag
+rm -f .tmp-tag .tmp-tag.sig
diff --git a/mktag.c b/mktag.c
--- a/mktag.c
+++ b/mktag.c
@@ -42,7 +42,7 @@ static int verify_tag(char *buffer, unsi
 	int typelen;
 	char type[20];
 	unsigned char sha1[20];
-	const char *object, *type_line, *tag_line;
+	const char *object, *type_line, *tag_line, *tagger_line;
 
 	if (size < 64 || size > MAXSIZE-1)
 		return -1;
@@ -91,6 +91,11 @@ static int verify_tag(char *buffer, unsi
 			continue;
 		return -1;
 	}
+	/* Verify the tagger line */
+	tagger_line = tag_line;
+
+	if (memcmp(tagger_line, "tagger ", 7) || (tagger_line[7] == '\n'))
+		return -1;
 
 	/* The actual stuff afterwards we don't care about.. */
 	return 0;
@@ -119,7 +124,7 @@ int main(int argc, char **argv)
 		size += ret;
 	}
 
-	// Verify it for some basic sanity: it needs to start with "object <sha1>\ntype "
+	// Verify it for some basic sanity: it needs to start with "object <sha1>\ntype\ntagger "
 	if (verify_tag(buffer, size) < 0)
 		die("invalid tag signature file");
 

  parent reply	other threads:[~2005-07-07  3:36 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30 17:54 "git-send-pack" Linus Torvalds
2005-06-30 18:24 ` "git-send-pack" A Large Angry SCM
2005-06-30 18:27   ` "git-send-pack" A Large Angry SCM
2005-06-30 19:04   ` "git-send-pack" Linus Torvalds
2005-06-30 18:45 ` "git-send-pack" Jan Harkes
2005-06-30 19:01 ` "git-send-pack" Mike Taht
2005-06-30 19:42   ` "git-send-pack" Linus Torvalds
2005-07-01  9:50     ` "git-send-pack" Matthias Urlichs
2005-06-30 19:44 ` "git-send-pack" Linus Torvalds
2005-06-30 20:38   ` "git-send-pack" Junio C Hamano
2005-06-30 21:05     ` "git-send-pack" Daniel Barkalow
2005-06-30 21:29       ` "git-send-pack" Linus Torvalds
2005-06-30 21:55         ` "git-send-pack" H. Peter Anvin
2005-06-30 22:26           ` "git-send-pack" Linus Torvalds
2005-06-30 23:40             ` "git-send-pack" H. Peter Anvin
2005-07-01  0:02               ` "git-send-pack" Linus Torvalds
2005-07-01  1:24                 ` "git-send-pack" H. Peter Anvin
2005-07-01 23:44                 ` "git-send-pack" Mike Taht
2005-07-02  0:07                   ` "git-send-pack" H. Peter Anvin
2005-07-02  1:56                   ` "git-send-pack" Linus Torvalds
2005-07-02  4:08                     ` "git-send-pack" H. Peter Anvin
2005-07-02  4:22                       ` "git-send-pack" Linus Torvalds
2005-07-02  4:29                         ` "git-send-pack" H. Peter Anvin
2005-07-02 17:16                           ` "git-send-pack" Linus Torvalds
2005-07-02 17:37                             ` "git-send-pack" H. Peter Anvin
2005-07-02 17:44                             ` "git-send-pack" Tony Luck
2005-07-02 17:48                               ` "git-send-pack" H. Peter Anvin
2005-07-02 18:12                                 ` "git-send-pack" A Large Angry SCM
2005-06-30 22:25         ` "git-send-pack" Daniel Barkalow
2005-06-30 23:56           ` "git-send-pack" Linus Torvalds
2005-07-01  5:01             ` "git-send-pack" Daniel Barkalow
2005-06-30 21:08     ` "git-send-pack" Linus Torvalds
2005-06-30 21:10     ` "git-send-pack" Dan Holmsand
2005-06-30 19:49 ` "git-send-pack" Daniel Barkalow
2005-06-30 20:12   ` "git-send-pack" Linus Torvalds
2005-06-30 20:23     ` "git-send-pack" H. Peter Anvin
2005-06-30 20:52       ` "git-send-pack" Linus Torvalds
2005-06-30 21:23         ` "git-send-pack" H. Peter Anvin
2005-06-30 21:26           ` "git-send-pack" H. Peter Anvin
2005-06-30 21:42           ` "git-send-pack" Linus Torvalds
2005-06-30 22:00             ` "git-send-pack" H. Peter Anvin
2005-07-01 10:31               ` "git-send-pack" Matthias Urlichs
2005-07-01 14:43                 ` "git-send-pack" Jan Harkes
2005-07-01 13:56               ` Tags Eric W. Biederman
2005-07-01 16:37                 ` Tags H. Peter Anvin
2005-07-01 22:38                   ` Tags Eric W. Biederman
2005-07-01 22:44                     ` Tags H. Peter Anvin
2005-07-01 23:07                       ` Tags Eric W. Biederman
2005-07-01 23:22                         ` Tags Daniel Barkalow
2005-07-02  0:06                         ` Tags H. Peter Anvin
2005-07-02  7:00                           ` Tags Eric W. Biederman
2005-07-02 17:47                             ` Tags H. Peter Anvin
2005-07-02 17:54                               ` Tags Eric W. Biederman
2005-07-02 17:58                                 ` Tags H. Peter Anvin
2005-07-02 18:31                                   ` Tags Eric W. Biederman
2005-07-02 19:55                                     ` Tags Matthias Urlichs
2005-07-02 21:16                                     ` Tags H. Peter Anvin
2005-07-02 21:39                                       ` Tags Linus Torvalds
2005-07-02 21:42                                         ` Tags H. Peter Anvin
2005-07-02 22:02                                           ` Tags A Large Angry SCM
2005-07-02 22:20                                             ` Tags Linus Torvalds
2005-07-02 23:49                                               ` Tags A Large Angry SCM
2005-07-03  0:17                                                 ` Tags Linus Torvalds
2005-07-02 22:14                                           ` Tags Petr Baudis
2005-07-02 22:17                                           ` Tags Linus Torvalds
2005-07-03  0:04                                             ` Tags Dan Holmsand
2005-07-03 22:34                                               ` Tags Kevin Smith
2005-07-05 13:04                                             ` Tags Eric W. Biederman
2005-07-05 16:21                                               ` Tags Daniel Barkalow
2005-07-05 17:51                                                 ` Tags Eric W. Biederman
2005-07-05 18:33                                                   ` Tags Linus Torvalds
2005-07-05 19:22                                                     ` Tags Junio C Hamano
2005-07-06 18:04                                                       ` Tags Matthias Urlichs
2005-07-07  3:31                                                     ` Eric W. Biederman [this message]
2005-07-02 18:45                                   ` Tags Linus Torvalds
2005-07-02 20:38                           ` Tags Jan Harkes
2005-07-02 22:32                             ` Tags Jan Harkes
2005-07-02 16:00                       ` Tags Matthias Urlichs
2005-07-01 18:09                 ` Tags Petr Baudis
2005-07-01 18:37                   ` Tags H. Peter Anvin
2005-07-01 21:20                     ` Tags Matthias Urlichs
2005-07-01 21:42                     ` Tags Petr Baudis
2005-07-01 21:52                       ` Tags H. Peter Anvin
2005-07-01 22:27                         ` Tags Daniel Barkalow
2005-07-01 22:59                         ` Tags Petr Baudis
2005-06-30 20:49     ` "git-send-pack" Daniel Barkalow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m13bqrwaux.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=barkalow@iabervon.org \
    --cc=ftpadmin@kernel.org \
    --cc=git@vger.kernel.org \
    --cc=hpa@zytor.com \
    --cc=junkio@cox.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).