git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Petr Baudis <pasky@ucw.cz>, git <git@vger.kernel.org>
Subject: [PATCH] commit-id, tree-id fail on tags
Date: Wed, 17 Aug 2005 00:27:38 -0400	[thread overview]
Message-ID: <1124252858.26240.31.camel@dv> (raw)

Hello!

Tag names don't work with current cogito because commit-id and tree-id
don't parse the cg-Xnormid output properly.

Namely, if $type is empty (which is the case for tags), $normid is used
before the trailing space is stripped from it.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/commit-id b/commit-id
--- a/commit-id
+++ b/commit-id
@@ -9,8 +9,9 @@
 
 id="$1"
 normid=$(. ${COGITO_LIB}cg-Xnormid "$id") || exit 1
-type=${normid#* }; [ "$type" ] || type=$(git-cat-file -t "$normid")
+type=${normid#* }
 normid=${normid% *}
+[ "$type" ] || type=$(git-cat-file -t "$normid")
 
 if [ "$type" != "commit" ]; then
 	echo "Invalid commit id: $normid" >&2
diff --git a/tree-id b/tree-id
--- a/tree-id
+++ b/tree-id
@@ -7,8 +7,9 @@
 
 id="$1"
 normid=$(. ${COGITO_LIB}cg-Xnormid "$id") || exit 1
-type=${normid#* }; [ "$type" ] || type=$(git-cat-file -t "$normid")
+type=${normid#* }
 normid=${normid% *}
+[ "$type" ] || type=$(git-cat-file -t "$normid")
 
 if [ "$type" = "commit" ]; then
 	normid=$(git-cat-file commit "$normid" | sed -e 's/tree //;q')


-- 
Regards,
Pavel Roskin

                 reply	other threads:[~2005-08-17  4:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=1124252858.26240.31.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /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.
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).