git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix "git tag -u" breakage
@ 2007-01-31  4:00 Linus Torvalds
  2007-01-31  4:56 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2007-01-31  4:00 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List, Andy Parkins


The recent cleanup to understand

	[user]
		signingkey = ..

sadly broke the old "-u signingkey" syntax. Admittedly the config file 
approach is nicer, and I should probably use it, but even so, there's 
really no reason to break the old syntax either.

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

This fixes it for me, and _looks_ obvious enough, but I didn't actually 
test the other cases (ie tagger name and the config file). Caveat patchor.

diff --git a/git-tag.sh b/git-tag.sh
index 988bf4c..c2c57d5 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -115,6 +115,7 @@ tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
 
 keyid=$(git-repo-config user.signingkey) ||
 	keyid=$(expr "z$tagger" : 'z\(.*>\)')
+username=${username:-$keyid}
 
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 
@@ -141,7 +142,7 @@ if [ "$annotate" ]; then
       cat "$GIT_DIR"/TAG_FINALMSG ) >"$GIT_DIR"/TAG_TMP
     rm -f "$GIT_DIR"/TAG_TMP.asc "$GIT_DIR"/TAG_FINALMSG
     if [ "$signed" ]; then
-	gpg -bsa -u "$keyid" "$GIT_DIR"/TAG_TMP &&
+	gpg -bsa -u "$username" "$GIT_DIR"/TAG_TMP &&
 	cat "$GIT_DIR"/TAG_TMP.asc >>"$GIT_DIR"/TAG_TMP ||
 	die "failed to sign the tag with GPG."
     fi

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

* Re: Fix "git tag -u" breakage
  2007-01-31  4:00 Fix "git tag -u" breakage Linus Torvalds
@ 2007-01-31  4:56 ` Junio C Hamano
  2007-01-31  8:37   ` Andy Parkins
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-01-31  4:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Linus Torvalds <torvalds@linux-foundation.org> writes:

> The recent cleanup to understand
>
> 	[user]
> 		signingkey = ..
>
> sadly broke the old "-u signingkey" syntax. Admittedly the config file 
> approach is nicer, and I should probably use it, but even so, there's 
> really no reason to break the old syntax either.
>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> ---
>
> This fixes it for me, and _looks_ obvious enough, but I didn't actually 
> test the other cases (ie tagger name and the config file). Caveat patchor.

Sorry, and thanks.

There was no reason to introduce a separate variable keyid to
begin with.  I should have been more careful to read what was
outside of the patch.

diff --git a/git-tag.sh b/git-tag.sh
index 988bf4c..4a0a7b6 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -113,8 +113,9 @@ object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
 type=$(git-cat-file -t $object) || exit 1
 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
 
-keyid=$(git-repo-config user.signingkey) ||
-	keyid=$(expr "z$tagger" : 'z\(.*>\)')
+test -n "$username" ||
+	username=$(git-repo-config user.signingkey) ||
+	username=$(expr "z$tagger" : 'z\(.*>\)')
 
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 
@@ -141,7 +142,7 @@ if [ "$annotate" ]; then
       cat "$GIT_DIR"/TAG_FINALMSG ) >"$GIT_DIR"/TAG_TMP
     rm -f "$GIT_DIR"/TAG_TMP.asc "$GIT_DIR"/TAG_FINALMSG
     if [ "$signed" ]; then
-	gpg -bsa -u "$keyid" "$GIT_DIR"/TAG_TMP &&
+	gpg -bsa -u "$username" "$GIT_DIR"/TAG_TMP &&
 	cat "$GIT_DIR"/TAG_TMP.asc >>"$GIT_DIR"/TAG_TMP ||
 	die "failed to sign the tag with GPG."
     fi

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

* Re: Fix "git tag -u" breakage
  2007-01-31  4:56 ` Junio C Hamano
@ 2007-01-31  8:37   ` Andy Parkins
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Parkins @ 2007-01-31  8:37 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Linus Torvalds

On Wednesday 2007 January 31 04:56, Junio C Hamano wrote:

> Sorry, and thanks.

Apologies - I thought I had searched for all instances of username in the 
script.  Perhaps I just looked for $username.  Duh.

> There was no reason to introduce a separate variable keyid to
> begin with.  I should have been more careful to read what was
> outside of the patch.

The change of name was to indicate that the variable isn't actually holding a 
username anymore, it really is a key ID.  GPG will let you specify a key in a 
number of ways, only one of which is by username.  Therefore, I think a 
better patch would be to finish what I started and change the remaining two 
instances of username to keyid.

diff --git a/git-tag.sh b/git-tag.sh
index 988bf4c..0898a70 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -10,7 +10,7 @@ annotate=
 signed=
 force=
 message=
-username=
+keyid=
 list=
 verify=
 while case "$#" in 0) break ;; esac
@@ -59,7 +59,7 @@ do
    annotate=1
    signed=1
    shift
-   username="$1"
+   keyid="$1"
    ;;
     -d)
        shift



Andy

-- 
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com

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

end of thread, other threads:[~2007-01-31  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-31  4:00 Fix "git tag -u" breakage Linus Torvalds
2007-01-31  4:56 ` Junio C Hamano
2007-01-31  8:37   ` Andy Parkins

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).