Subject: Re: git describe bug?

From: Andreas Ericsson <[email-masked]>
Date: Tue, 06 Apr 2010 11:48:39 +0200

On 04/02/2010 08:31 PM, Shawn O. Pearce wrote:
> Dustin Sallings<[email-masked]>  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 <[email-masked]>
Date:   Tue Apr 6 11:27:28 2010 +0200

sdf

commit 8b5fe8c9ec3f961ec9b09844eca6225f06af5b0b
...
  $ git show v100
tag v100
Tagger: Andreas Ericsson <[email-masked]>
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                   [email-masked]
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.