Linus Torvalds <[EMAIL PROTECTED]> 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");
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html