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

Re: [PATCH] Cogito: Use git-rev-parse instead of cg-Xnormid.

From
BGBrian Gerst <bgerst@didntduck.org>
Date
Jul 3, 2005, 12:25 UTC
Message-ID
<42C7D925.2070007@didntduck.org>
In-Reply-To
<20050703065920.GA11765@pasky.ji.cz>
Petr Baudis wrote:
Show 12 quoted lines
> Dear diary, on Sun, Jul 03, 2005 at 07:59:42AM CEST, I got a letter
> where Brian Gerst <bgerst@didntduck.org> told me that...
> 
>>Use git-rev-parse instead of cg-Xnormid.  This allows Cogito to work 
>>properly with packed objects.
>>
>>Signed off by: Brian Gerst <bgerst@didntduck.org>
> 
> 
> But git-rev-parse sucks. It won't detect invalid IDs (--revs-only?), and
> does not support short object IDs (that's a must, it's tremendously
> useful). You need to add that for it to be useful first.

cg-Xnormid is terminally broken in the presence of packed files, since it cannot look into them to find objects. Moreover, many uses of commit-id in the scripts can be eliminated because the underlying git commands can already understand tags directly, and will check for invalid ids then. The only thing missing is the short id matching.

Show 22 quoted lines
> 
> 
>>diff --git a/tree-id b/tree-id
>>--- a/tree-id
>>+++ b/tree-id
>>@@ -5,8 +5,8 @@
>> #
>> # Takes ID of the appropriate commit, defaults to HEAD.
>> 
>>-id="$1"
>>-normid=$(${COGITO_LIB}cg-Xnormid "$id") || exit 1
>>+id="${1:-HEAD}"
>>+normid=$(git-rev-parse "$id")
>> type=$(git-cat-file -t "$normid")
>> 
>> if [ "$type" = "commit" ]; then
> 
> 
> This is broken too. You need to be able to pass _tree_ ID to tree-id too,
> not just commit ID. Hmm, or is git-rev-parse able to process any ids?
> Then it's terribly misnamed too. :-) A comment would be useful in that
> case. (Or better a patch to rename it.)
Yes you can still pass in the tree id.
--
				Brian Gerst
Previous: Petr BaudisNext: Petr Baudis
Message 3 of 8 in “Cogito: Use git-rev-parse instead of cg-Xnormid.”
  1. Cogito: Use git-rev-parse instead of cg-Xnormid.Brian Gerst, Jul 3, 2005
  2. Petr BaudisJul 3, 2005
  3. Brian GerstJul 3, 2005
  4. Petr BaudisJul 3, 2005
  5. Sven VerdoolaegeJul 3, 2005
  6. Petr BaudisJul 3, 2005
  7. Linus TorvaldsJul 3, 2005
  8. Petr BaudisJul 3, 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.