git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug in 'git describe' if I have two tags on the same commit.
@ 2017-02-12 12:15 Istvan Pato
  2017-02-13 15:44 ` Kevin Daudt
  0 siblings, 1 reply; 4+ messages in thread
From: Istvan Pato @ 2017-02-12 12:15 UTC (permalink / raw)
  To: git

I didn't get back the latest tag by 'git describe --tags --always' if
I have two tags on the same commit.

// repository ppa:git-core/ppa

(master)⚡ % cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

(master)⚡ % git --version
git version 2.11.0

(master) [1] % git show-ref --tag
76c634390... refs/tags/1.0.0
b77c7cd17... refs/tags/1.1.0
b77c7cd17... refs/tags/1.2.0

(master) % git describe --tags --always
1.1.0-1-ge9e9ced

### Expected: 1.2.0

References:

https://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.7.1.1.txt

* "git describe" did not tie-break tags that point at the same commit
  correctly; newer ones are preferred by paying attention to the
  tagger date now.

http://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit

Thanks,
Istvan Pato

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in 'git describe' if I have two tags on the same commit.
  2017-02-12 12:15 Bug in 'git describe' if I have two tags on the same commit Istvan Pato
@ 2017-02-13 15:44 ` Kevin Daudt
  2017-02-13 20:35   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Daudt @ 2017-02-13 15:44 UTC (permalink / raw)
  To: Istvan Pato; +Cc: git

On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:
> I didn't get back the latest tag by 'git describe --tags --always' if
> I have two tags on the same commit.
> 
> // repository ppa:git-core/ppa
> 
> (master)⚡ % cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
> 
> (master)⚡ % git --version
> git version 2.11.0
> 
> (master) [1] % git show-ref --tag
> 76c634390... refs/tags/1.0.0
> b77c7cd17... refs/tags/1.1.0
> b77c7cd17... refs/tags/1.2.0
> 
> (master) % git describe --tags --always
> 1.1.0-1-ge9e9ced
> 
> ### Expected: 1.2.0
> 
> References:
> 
> https://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.7.1.1.txt
> 
> * "git describe" did not tie-break tags that point at the same commit
>   correctly; newer ones are preferred by paying attention to the
>   tagger date now.
> 
> http://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit
> 
> Thanks,
> Istvan Pato

Are these lightweight tags? Only annotated tags have a date associated
to them, which is where the rel-notes refers to. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in 'git describe' if I have two tags on the same commit.
  2017-02-13 15:44 ` Kevin Daudt
@ 2017-02-13 20:35   ` Junio C Hamano
  2017-02-14  8:07     ` Istvan Pato
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2017-02-13 20:35 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: Istvan Pato, git

Kevin Daudt <me@ikke.info> writes:

> On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:
>
>> (master) [1] % git show-ref --tag
>> 76c634390... refs/tags/1.0.0
>> b77c7cd17... refs/tags/1.1.0
>> b77c7cd17... refs/tags/1.2.0
>> 
>> (master) % git describe --tags --always
>> 1.1.0-1-ge9e9ced
>> 
>> ### Expected: 1.2.0
>> ...
>
> Are these lightweight tags? Only annotated tags have a date associated
> to them, which is where the rel-notes refers to. 

Good eyes.  The fact that the two points at the same object means
that even if they were both annotated tags, they have the same
tagger dates.

If the code that compares the candidates and picks better tag to
describe the object with knows the refnames of these "tags", I'd
imagine that we could use the versioncmp() logic as the final tie
breaker, but I do not offhand remember if the original refname we
took the tag (or commit) from is propagated that deep down the
callchain.  It probably does not, so some code refactoring may be
needed if somebody wants to go in that direction.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in 'git describe' if I have two tags on the same commit.
  2017-02-13 20:35   ` Junio C Hamano
@ 2017-02-14  8:07     ` Istvan Pato
  0 siblings, 0 replies; 4+ messages in thread
From: Istvan Pato @ 2017-02-14  8:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Kevin Daudt, git

This is my fault: this is a lightweight tag.
Thank you!

2017-02-13 21:35 GMT+01:00 Junio C Hamano <gitster@pobox.com>:
> Kevin Daudt <me@ikke.info> writes:
>
>> On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:
>>
>>> (master) [1] % git show-ref --tag
>>> 76c634390... refs/tags/1.0.0
>>> b77c7cd17... refs/tags/1.1.0
>>> b77c7cd17... refs/tags/1.2.0
>>>
>>> (master) % git describe --tags --always
>>> 1.1.0-1-ge9e9ced
>>>
>>> ### Expected: 1.2.0
>>> ...
>>
>> Are these lightweight tags? Only annotated tags have a date associated
>> to them, which is where the rel-notes refers to.
>
> Good eyes.  The fact that the two points at the same object means
> that even if they were both annotated tags, they have the same
> tagger dates.
>
> If the code that compares the candidates and picks better tag to
> describe the object with knows the refnames of these "tags", I'd
> imagine that we could use the versioncmp() logic as the final tie
> breaker, but I do not offhand remember if the original refname we
> took the tag (or commit) from is propagated that deep down the
> callchain.  It probably does not, so some code refactoring may be
> needed if somebody wants to go in that direction.
>
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-14  8:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-12 12:15 Bug in 'git describe' if I have two tags on the same commit Istvan Pato
2017-02-13 15:44 ` Kevin Daudt
2017-02-13 20:35   ` Junio C Hamano
2017-02-14  8:07     ` Istvan Pato

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).