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

Re: git describe bug?

From
Andreas Ericsson <ae@op5.se>
Date
Apr 6, 2010, 09:48 UTC
Message-ID
<4BBB0377.8080007@op5.se>
In-Reply-To
<20100402183147.GA20007@spearce.org>
On 04/02/2010 08:31 PM, Shawn O. Pearce wrote:
Show 20 quoted lines
> Dustin Sallings<dustin@spy.net>  wrote:
>>
>> 	describe does not choose the most recent tag when multiple tags point to a single commit (for example, when an RC release becomes a proper release).
>>
>> 	There's a bit of conflict in the documentation between the following:
>>
>> 		``tags with newer dates will always be preferred over tags with older dates''
>>
>> 	and the next sentence:
>>
>> 		``If an exact match is found, its name will be output and searching will stop.''
>>
>> 	The code does not allow for multiple exact matches, leading to what I would consider incorrect behavior as shown below:
> 
> Yes, I've seen this too.  IIRC we've actually discussed this in
> the past.  I can't find the thread (my search skills are sub-par
> despite who I work for...).  But the general idea if I remember
> it right was we wanted to use the older tag, because that tag
> came first.
> 
Right now the behaviour is inconsistent. In the latest git repo
I tried the following:
  $ git tag -a v99 -msdf
  $ git tag -a v100 -m100
  $ git describe
v100
  $ git describe v99
v100
  $ git describe v100
v100
  $ git show v99
tag v99
Tagger: Andreas Ericsson <ae@op5.se>
Date:   Tue Apr 6 11:27:28 2010 +0200
sdf
commit 8b5fe8c9ec3f961ec9b09844eca6225f06af5b0b
...
  $ git show v100
tag v100
Tagger: Andreas Ericsson <ae@op5.se>
Date:   Tue Apr 6 11:27:37 2010 +0200
100

commit 8b5fe8c9ec3f961ec9b09844eca6225f06af5b0b ...

  $ ls .git/refs/tags/v{100,99}
.git/refs/tags/v100  .git/refs/tags/v99

So as you can see, something else is going on. Both tags here are stashed as loose objects and both refs are unpacked.

Using either strverscmp(3) or allowing one to sort by tagging date with the option to use first or latest would be preferrable. I'll see what I can cook up during my lunch-break.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 17 in “git describe bug?”
  1. Dustin SallingsApr 2, 2010
  2. Shawn O. PearceApr 2, 2010
  3. Andreas EricssonApr 6, 2010
  4. Shawn O. PearceApr 11, 2010
  5. describe: Break annotated tag ties by tagger dateShawn O. Pearce, Apr 11, 2010
  6. Junio C HamanoApr 11, 2010
  7. Shawn O. PearceApr 11, 2010
  8. 1/5 tag.c: Correct indentationShawn O. Pearce, Apr 12, 2010
  9. 2/5 tag.h: Remove unused signature fieldShawn O. Pearce, Apr 12, 2010
  10. 3/5 tag.c: Refactor parse_tag_buffer to be saner to programShawn O. Pearce, Apr 12, 2010
  11. 4/5 tag.c: Parse tagger date (if present)Shawn O. Pearce, Apr 12, 2010
  12. 5/5 describe: Break annotated tag ties by tagger dateShawn O. Pearce, Apr 12, 2010
  13. Andreas EricssonApr 13, 2010
  14. Thomas RastApr 13, 2010
  15. Shawn O. PearceApr 13, 2010
  16. Junio C HamanoApr 13, 2010
  17. Shawn O. PearceApr 13, 2010

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.