{"thread":{"id":"45118","subject":"Bug in 'git describe' if I have two tags on the same commit.","startedAt":"2017-02-12T12:15:29Z","lastAt":"2017-02-14T08:07:55Z","messageCount":4,"participants":["Istvan Pato","Kevin Daudt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"311358","messageId":"CAOcUJQwnCJOhUUU2RqJP2H5YxUr4qCEpyDj_XiiQSe4V6rcBmg@mail.gmail.com","threadId":"45118","inReplyTo":null,"subject":"Bug in 'git describe' if I have two tags on the same commit.","fromName":"Istvan Pato","fromEmail":"istvan.pato@gmail.com","sentAt":"2017-02-12T12:15:22Z","receivedAt":"2017-02-12T12:15:29Z","isPatch":false,"sender":{"key":"istvan.pato@gmail.com","avatar":null},"body":"I didn't get back the latest tag by 'git describe --tags --always' if\nI have two tags on the same commit.\n\n// repository ppa:git-core/ppa\n\n(master)⚡ % cat /etc/lsb-release\nDISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=16.04\nDISTRIB_CODENAME=xenial\nDISTRIB_DESCRIPTION=\"Ubuntu 16.04.2 LTS\"\n\n(master)⚡ % git --version\ngit version 2.11.0\n\n(master) [1] % git show-ref --tag\n76c634390... refs/tags/1.0.0\nb77c7cd17... refs/tags/1.1.0\nb77c7cd17... refs/tags/1.2.0\n\n(master) % git describe --tags --always\n1.1.0-1-ge9e9ced\n\n### Expected: 1.2.0\n\nReferences:\n\nhttps://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.7.1.1.txt\n\n* \"git describe\" did not tie-break tags that point at the same commit\n  correctly; newer ones are preferred by paying attention to the\n  tagger date now.\n\nhttp://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit\n\nThanks,\nIstvan Pato\n"},{"id":"311408","messageId":"20170213154407.GA31568@alpha.ikke.info","threadId":"45118","inReplyTo":"CAOcUJQwnCJOhUUU2RqJP2H5YxUr4qCEpyDj_XiiQSe4V6rcBmg@mail.gmail.com","subject":"Re: Bug in 'git describe' if I have two tags on the same commit.","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2017-02-13T15:44:07Z","receivedAt":"2017-02-13T15:54:14Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:\n> I didn't get back the latest tag by 'git describe --tags --always' if\n> I have two tags on the same commit.\n> \n> // repository ppa:git-core/ppa\n> \n> (master)⚡ % cat /etc/lsb-release\n> DISTRIB_ID=Ubuntu\n> DISTRIB_RELEASE=16.04\n> DISTRIB_CODENAME=xenial\n> DISTRIB_DESCRIPTION=\"Ubuntu 16.04.2 LTS\"\n> \n> (master)⚡ % git --version\n> git version 2.11.0\n> \n> (master) [1] % git show-ref --tag\n> 76c634390... refs/tags/1.0.0\n> b77c7cd17... refs/tags/1.1.0\n> b77c7cd17... refs/tags/1.2.0\n> \n> (master) % git describe --tags --always\n> 1.1.0-1-ge9e9ced\n> \n> ### Expected: 1.2.0\n> \n> References:\n> \n> https://www.kernel.org/pub/software/scm/git/docs/RelNotes-1.7.1.1.txt\n> \n> * \"git describe\" did not tie-break tags that point at the same commit\n>   correctly; newer ones are preferred by paying attention to the\n>   tagger date now.\n> \n> http://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit\n> \n> Thanks,\n> Istvan Pato\n\nAre these lightweight tags? Only annotated tags have a date associated\nto them, which is where the rel-notes refers to. \n"},{"id":"311431","messageId":"xmqqo9y5de1k.fsf@gitster.mtv.corp.google.com","threadId":"45118","inReplyTo":"20170213154407.GA31568@alpha.ikke.info","subject":"Re: Bug in 'git describe' if I have two tags on the same commit.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-13T20:35:51Z","receivedAt":"2017-02-13T20:35:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Daudt <me@ikke.info> writes:\n\n> On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:\n>\n>> (master) [1] % git show-ref --tag\n>> 76c634390... refs/tags/1.0.0\n>> b77c7cd17... refs/tags/1.1.0\n>> b77c7cd17... refs/tags/1.2.0\n>> \n>> (master) % git describe --tags --always\n>> 1.1.0-1-ge9e9ced\n>> \n>> ### Expected: 1.2.0\n>> ...\n>\n> Are these lightweight tags? Only annotated tags have a date associated\n> to them, which is where the rel-notes refers to. \n\nGood eyes.  The fact that the two points at the same object means\nthat even if they were both annotated tags, they have the same\ntagger dates.\n\nIf the code that compares the candidates and picks better tag to\ndescribe the object with knows the refnames of these \"tags\", I'd\nimagine that we could use the versioncmp() logic as the final tie\nbreaker, but I do not offhand remember if the original refname we\ntook the tag (or commit) from is propagated that deep down the\ncallchain.  It probably does not, so some code refactoring may be\nneeded if somebody wants to go in that direction.\n\n\n\n\n\n"},{"id":"311525","messageId":"CAOcUJQzEKoCf3T2AVzck1Y4NWb8N9FMqQ=+6z6-9C4YF8-jQzA@mail.gmail.com","threadId":"45118","inReplyTo":"xmqqo9y5de1k.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug in 'git describe' if I have two tags on the same commit.","fromName":"Istvan Pato","fromEmail":"istvan.pato@gmail.com","sentAt":"2017-02-14T08:07:48Z","receivedAt":"2017-02-14T08:07:55Z","isPatch":false,"sender":{"key":"istvan.pato@gmail.com","avatar":null},"body":"This is my fault: this is a lightweight tag.\nThank you!\n\n2017-02-13 21:35 GMT+01:00 Junio C Hamano <gitster@pobox.com>:\n> Kevin Daudt <me@ikke.info> writes:\n>\n>> On Sun, Feb 12, 2017 at 01:15:22PM +0100, Istvan Pato wrote:\n>>\n>>> (master) [1] % git show-ref --tag\n>>> 76c634390... refs/tags/1.0.0\n>>> b77c7cd17... refs/tags/1.1.0\n>>> b77c7cd17... refs/tags/1.2.0\n>>>\n>>> (master) % git describe --tags --always\n>>> 1.1.0-1-ge9e9ced\n>>>\n>>> ### Expected: 1.2.0\n>>> ...\n>>\n>> Are these lightweight tags? Only annotated tags have a date associated\n>> to them, which is where the rel-notes refers to.\n>\n> Good eyes.  The fact that the two points at the same object means\n> that even if they were both annotated tags, they have the same\n> tagger dates.\n>\n> If the code that compares the candidates and picks better tag to\n> describe the object with knows the refnames of these \"tags\", I'd\n> imagine that we could use the versioncmp() logic as the final tie\n> breaker, but I do not offhand remember if the original refname we\n> took the tag (or commit) from is propagated that deep down the\n> callchain.  It probably does not, so some code refactoring may be\n> needed if somebody wants to go in that direction.\n>\n>\n>\n>\n>\n"}]}