git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] commit-id, tree-id fail on tags

From
PRPavel Roskin <proski@gnu.org>
Date
Aug 17, 2005, 04:27 UTC
Message-ID
<1124252858.26240.31.camel@dv>
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
Message 1 of 1 in “commit-id, tree-id fail on tags”
  1. commit-id, tree-id fail on tagsPavel Roskin, Aug 17, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.