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

Re: [PATCH 5/6] Teach git-describe --exact-match to avoid expensive tag searches

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 24, 2008, 10:32 UTC
Message-ID
<20080224103223.GI8410@spearce.org>
In-Reply-To
<m3skzibqjo.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> wrote:
Show 13 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> >  A common idiom is to run git-describe twice:
> > 
> >   if test $(git describe $commit) = $(git describe --abbrev=0 $commit)
> >   ...
> 
> Wouldn't it be easier to use?
> 
>     if test $(git rev-parse $(git describe --abbrev=0 $commit)^0) = $commit
> 
> But this is also one unnecessary, although not as costly, call to git
> command.

Yea, that's the other way I've done this in a script before. But its obtuse and non-obvious. --exact-match is a little easier to figure out. :-)

-- 
Shawn.
Previous: Jakub Narebski
Message 3 of 3 in “Teach git-describe --exact-match to avoid expensive tag searches”
  1. 5/6 Teach git-describe --exact-match to avoid expensive tag searchesShawn O. Pearce, Feb 24, 2008
  2. Jakub NarebskiFeb 24, 2008
  3. Shawn O. PearceFeb 24, 2008

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.