{"thread":{"id":"15698","subject":"git-describe doesn't show the most recent tag","startedAt":"2008-09-28T13:48:42Z","lastAt":"2008-10-15T20:05:34Z","messageCount":26,"participants":["Erez Zilber","Pierre Habouzit","Andreas Ericsson","Shawn O. Pearce","Uwe Kleine-König","Junio C Hamano","Santi Béjar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91795","messageId":"ce513bcc0809280648s352cda3fj5eb35b6e9cd40af9@mail.gmail.com","threadId":"15698","inReplyTo":null,"subject":"git-describe doesn't show the most recent tag","fromName":"Erez Zilber","fromEmail":"erezzi.list-re5jqeeqqe8avxtiumwx3w@public.gmane.org","sentAt":"2008-09-28T13:48:42Z","receivedAt":"2008-09-28T13:48:42Z","isPatch":false,"sender":{"key":"erezzi.list-re5jqeeqqe8avxtiumwx3w@public.gmane.org","avatar":null},"body":"\nHi,\n\nI'm trying to run git-describe on the open-iscsi git tree\n(git://git.kernel.org/pub/scm/linux/kernel/git/mnc/open-iscsi.git):\n\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-branch -a\n* master\n  origin/2.0-869-bugfix\n  origin/HEAD\n  origin/bnx2i\n  origin/cxgb3i\n  origin/master\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe\n2.0-868-rc1-81-g31c9d42\n\nHowever, there are newer tags than 2.0-868-rc1:\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-tag\n2.0-868-rc1\n2.0-869\n2.0-869-rc2\n2.0-869-rc3\n2.0-869-rc4\n2.0-869.1\n2.0-869.2\n2.0-870-rc1\n\n>From what I see in the man page \"git-describe - Show the most recent\ntag that is reachable from a commit\". In this repository, it doesn't\nlook like that...\n\nNow, I switch to the \"2.0-869-bugfix\" branch:\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-checkout -b\n2.0-869-bugfix origin/2.0-869-bugfix\nBranch 2.0-869-bugfix set up to track remote branch\nrefs/remotes/origin/2.0-869-bugfix.\nSwitched to a new branch \"2.0-869-bugfix\"\n\nand running again git-describe:\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe\n2.0-868-rc1-33-g81133dd\n\nOnly if I use the --tags flag, I get what I expected:\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe --tags\n2.0-869.2\n\nWhy is this happening?\n\nThanks,\nErez\n"},{"id":"91796","messageId":"20080928135526.GG5302@artemis.corp","threadId":"15698","inReplyTo":"ce513bcc0809280648s352cda3fj5eb35b6e9cd40af9@mail.gmail.com","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-09-28T13:55:26Z","receivedAt":"2008-09-28T13:55:26Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n> Why is this happening?\n\n       --tags\n           Instead of using only the annotated tags, use any tag found in\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n           .git/refs/tags.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"91797","messageId":"ce513bcc0809280729p47cc3790nb77b3cae8b805221@mail.gmail.com","threadId":"15698","inReplyTo":"20080928135526.GG5302@artemis.corp","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Erez Zilber","fromEmail":"erezzi.list@gmail.com","sentAt":"2008-09-28T14:29:21Z","receivedAt":"2008-09-28T14:29:21Z","isPatch":false,"sender":{"key":"erezzi.list@gmail.com","avatar":null},"body":"On Sun, Sep 28, 2008 at 4:55 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n> On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n>> Why is this happening?\n>\n>       --tags\n>           Instead of using only the annotated tags, use any tag found in\n>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n>           .git/refs/tags.\n>\n\nI'm not sure that I understand the difference between tags and annotated tags.\n\nAnyway, if I move to the master branch, I see the following tags:\n\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ ls .git/refs/tags/\n2.0-868-rc1  2.0-869  2.0-869.1  2.0-869.2  2.0-869-rc2  2.0-869-rc3\n2.0-869-rc4  2.0-870-rc1\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-tag\n2.0-868-rc1\n2.0-869\n2.0-869-rc2\n2.0-869-rc3\n2.0-869-rc4\n2.0-869.1\n2.0-869.2\n2.0-870-rc1\n\nHowever:\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe --tags\n2.0-868-rc1-81-g31c9d42\n\nI was expecting to see 2.0-870-rc1 here.\n\nErez\n"},{"id":"91798","messageId":"20080928143949.GH5302@artemis.corp","threadId":"15698","inReplyTo":"ce513bcc0809280729p47cc3790nb77b3cae8b805221@mail.gmail.com","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-09-28T14:39:49Z","receivedAt":"2008-09-28T14:39:49Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Sun, Sep 28, 2008 at 02:29:21PM +0000, Erez Zilber wrote:\n> On Sun, Sep 28, 2008 at 4:55 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n> > On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n> >> Why is this happening?\n> >\n> >       --tags\n> >           Instead of using only the annotated tags, use any tag found in\n> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n> >           .git/refs/tags.\n> >\n> \n> I'm not sure that I understand the difference between tags and annotated tags.\n\n  a lightweight tag is just a reference. an annotated tag has a message\nassociated. Usually tags are meant as local help, whereas annotated tags\nare the ones pushed to the repositories and that never change. That's\nwhy many tools ignore non annotated tags by default unless you pass\n--tags to them.\n\n> Anyway, if I move to the master branch, I see the following tags:\n> \n> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ ls .git/refs/tags/\n> 2.0-868-rc1  2.0-869  2.0-869.1  2.0-869.2  2.0-869-rc2  2.0-869-rc3\n> 2.0-869-rc4  2.0-870-rc1\n> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-tag\n> 2.0-868-rc1\n> 2.0-869\n> 2.0-869-rc2\n> 2.0-869-rc3\n> 2.0-869-rc4\n> 2.0-869.1\n> 2.0-869.2\n> 2.0-870-rc1\n> \n> However:\n> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe --tags\n> 2.0-868-rc1-81-g31c9d42\n> \n> I was expecting to see 2.0-870-rc1 here.\n\n  That's because master is not at -rc1 exactly, but some commits\nafterwards. Please read the git-describe manpage fully, it's _really_\nwell explained:\n\n       The command finds the most recent tag that is reachable from a commit.\n       If the tag points to the commit, then only the tag is shown. Otherwise,\n       it suffixes the tag name with the number of additional commits on top\n       of the tagged object and the abbreviated object name of the most recent\n       commit.\n\n\nWhich means that your master is 81 commits ahead of the exact 2.0-860-rc1 tag,\nat sha1 31c9d42\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"91799","messageId":"48DF99F3.2070503@op5.se","threadId":"15698","inReplyTo":"ce513bcc0809280729p47cc3790nb77b3cae8b805221@mail.gmail.com","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-28T14:51:31Z","receivedAt":"2008-09-28T14:51:31Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Erez Zilber wrote:\n> On Sun, Sep 28, 2008 at 4:55 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n>> On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n>>> Why is this happening?\n>>       --tags\n>>           Instead of using only the annotated tags, use any tag found in\n>>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n>>           .git/refs/tags.\n>>\n> \n> I'm not sure that I understand the difference between tags and annotated tags.\n> \n\nAn annotated tag is one created with \"git tag -a\" or \"git tag -s\".\nOther tags are considered \"lightweight\". They are supported for\ncreating immutable quick-and-dirty savepoints for private use,\nwhile published tags are supposed to be annotated to give them\nsome extra weight.\n\nYou can use lightweight tags like normal tags (ie, and publish\nthem), but then some assumptions in git will not be correct and\nyou need to tell it so.\n\nBtw, the default update hook prevents lightweight (unannotated)\ntags from entering a repository you're pushing to, so this\nassumption is not something that's unique to just \"describe\".\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91800","messageId":"20080928150318.GI5302@artemis.corp","threadId":"15698","inReplyTo":"20080928143949.GH5302@artemis.corp","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-09-28T15:03:18Z","receivedAt":"2008-09-28T15:03:18Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Sun, Sep 28, 2008 at 02:39:49PM +0000, Pierre Habouzit wrote:\n> On Sun, Sep 28, 2008 at 02:29:21PM +0000, Erez Zilber wrote:\n> > On Sun, Sep 28, 2008 at 4:55 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n> > > On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n> > >> Why is this happening?\n> > >\n> > >       --tags\n> > >           Instead of using only the annotated tags, use any tag found in\n> > >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n> > >           .git/refs/tags.\n> > >\n> > \n> > I'm not sure that I understand the difference between tags and annotated tags.\n> \n>   a lightweight tag is just a reference. an annotated tag has a message\n> associated. Usually tags are meant as local help, whereas annotated tags\n> are the ones pushed to the repositories and that never change. That's\n> why many tools ignore non annotated tags by default unless you pass\n> --tags to them.\n> \n> > Anyway, if I move to the master branch, I see the following tags:\n> > \n> > [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ ls .git/refs/tags/\n> > 2.0-868-rc1  2.0-869  2.0-869.1  2.0-869.2  2.0-869-rc2  2.0-869-rc3\n> > 2.0-869-rc4  2.0-870-rc1\n> > [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-tag\n> > 2.0-868-rc1\n> > 2.0-869\n> > 2.0-869-rc2\n> > 2.0-869-rc3\n> > 2.0-869-rc4\n> > 2.0-869.1\n> > 2.0-869.2\n> > 2.0-870-rc1\n> > \n> > However:\n> > [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe --tags\n> > 2.0-868-rc1-81-g31c9d42\n> > \n> > I was expecting to see 2.0-870-rc1 here.\n\n  Scratch my previous answer, I was confused with too many digits (868\nvs 870). In fact looking at the code, if there is an annotated tag in\nthe ancestry, git describe will always prefer it to lightweight tags.\n\n  the problem with lightweight tags is that they are meant to be moved,\nhence are not really something you want to base on to chose a uuid\n(which git-describe generates).\n\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"91801","messageId":"ce513bcc0809280805wb0598b7r8d5e89c1187b080d@mail.gmail.com","threadId":"15698","inReplyTo":"20080928143949.GH5302@artemis.corp","subject":"Re: git-describe doesn't show the most recent tag","fromName":"Erez Zilber","fromEmail":"erezzi.list@gmail.com","sentAt":"2008-09-28T15:05:51Z","receivedAt":"2008-09-28T15:05:51Z","isPatch":false,"sender":{"key":"erezzi.list@gmail.com","avatar":null},"body":"On Sun, Sep 28, 2008 at 5:39 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n> On Sun, Sep 28, 2008 at 02:29:21PM +0000, Erez Zilber wrote:\n>> On Sun, Sep 28, 2008 at 4:55 PM, Pierre Habouzit <madcoder@debian.org> wrote:\n>> > On Sun, Sep 28, 2008 at 01:48:42PM +0000, Erez Zilber wrote:\n>> >> Why is this happening?\n>> >\n>> >       --tags\n>> >           Instead of using only the annotated tags, use any tag found in\n>> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n>> >           .git/refs/tags.\n>> >\n>>\n>> I'm not sure that I understand the difference between tags and annotated tags.\n>\n>  a lightweight tag is just a reference. an annotated tag has a message\n> associated. Usually tags are meant as local help, whereas annotated tags\n> are the ones pushed to the repositories and that never change. That's\n> why many tools ignore non annotated tags by default unless you pass\n> --tags to them.\n\nThanks for the explanation.\n\n>\n>> Anyway, if I move to the master branch, I see the following tags:\n>>\n>> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ ls .git/refs/tags/\n>> 2.0-868-rc1  2.0-869  2.0-869.1  2.0-869.2  2.0-869-rc2  2.0-869-rc3\n>> 2.0-869-rc4  2.0-870-rc1\n>> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-tag\n>> 2.0-868-rc1\n>> 2.0-869\n>> 2.0-869-rc2\n>> 2.0-869-rc3\n>> 2.0-869-rc4\n>> 2.0-869.1\n>> 2.0-869.2\n>> 2.0-870-rc1\n>>\n>> However:\n>> [erez.zilber@erez-lx:/tmp/open-iscsi.git]$ git-describe --tags\n>> 2.0-868-rc1-81-g31c9d42\n>>\n>> I was expecting to see 2.0-870-rc1 here.\n>\n>  That's because master is not at -rc1 exactly, but some commits\n> afterwards. Please read the git-describe manpage fully, it's _really_\n> well explained:\n>\n>       The command finds the most recent tag that is reachable from a commit.\n>       If the tag points to the commit, then only the tag is shown. Otherwise,\n>       it suffixes the tag name with the number of additional commits on top\n>       of the tagged object and the abbreviated object name of the most recent\n>       commit.\n>\n>\n> Which means that your master is 81 commits ahead of the exact 2.0-860-rc1 tag,\n> at sha1 31c9d42\n\nI read that, but I still don't understand what happens in the open-iscsi tree:\n\n[erez.zilber@erez-lx:/tmp/open-iscsi.git]$ cat .git/refs/tags/2.0-870-rc1\n5e80c8167c112687ae7b30b1e40af6f03088c56c\n\nThe head is 12 commits from the 2.0-870-rc1 tag. Therefore, I expected\nto see something like 2.0-870-rc1-12-some_hash (not\n2.0-868-rc1-81-g31c9d42).\n\nErez\n"},{"id":"91803","messageId":"20080928151259.GJ5302@artemis.corp","threadId":"15698","inReplyTo":"20080928150318.GI5302@artemis.corp","subject":"[PATCH] doc: enhance git describe --tags help","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-09-28T15:12:59Z","receivedAt":"2008-09-28T15:12:59Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n Documentation/git-describe.txt |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\nindex c4dbc2a..9cc8c2f 100644\n--- a/Documentation/git-describe.txt\n+++ b/Documentation/git-describe.txt\n@@ -30,7 +30,8 @@ OPTIONS\n \n --tags::\n \tInstead of using only the annotated tags, use any tag\n-\tfound in `.git/refs/tags`.\n+\tfound in `.git/refs/tags`. Though if an annotated tag is found in the\n+\tancestry, it will always be preferred to lightweight tags.\n \n --contains::\n \tInstead of finding the tag that predates the commit, find\n-- \n1.6.0.2.516.g12936.dirty\n"},{"id":"91845","messageId":"20080929150127.GB18340@spearce.org","threadId":"15698","inReplyTo":"20080928151259.GJ5302@artemis.corp","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-29T15:01:27Z","receivedAt":"2008-09-29T15:01:27Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Pierre Habouzit <madcoder@debian.org> wrote:\n> diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\n> index c4dbc2a..9cc8c2f 100644\n> --- a/Documentation/git-describe.txt\n> +++ b/Documentation/git-describe.txt\n> @@ -30,7 +30,8 @@ OPTIONS\n>  \n>  --tags::\n>  \tInstead of using only the annotated tags, use any tag\n> -\tfound in `.git/refs/tags`.\n> +\tfound in `.git/refs/tags`. Though if an annotated tag is found in the\n> +\tancestry, it will always be preferred to lightweight tags.\n\nAs technically correct as the statement is, I read this and go\n\"why do we even have --tags?\".\n\nIf I read builtin-describe.c right we only honor --tags on an exact\nmatch, or if there are no annotated tags at all in the history.\nI wonder if docs like this aren't better for --tags:\n\n--tags::\n\tIf a lightweight tag exactly matches, output it.  If no\n\tannotated tag is found in the ancestry but a lightweight\n\ttag is found, output the lightweight tag.\n\n?\n\n-- \nShawn.\n"},{"id":"91909","messageId":"20080930083940.GA11453@artemis.corp","threadId":"15698","inReplyTo":"20080929150127.GB18340@spearce.org","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-09-30T08:39:40Z","receivedAt":"2008-09-30T08:39:40Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Mon, Sep 29, 2008 at 03:01:27PM +0000, Shawn O. Pearce wrote:\n> Pierre Habouzit <madcoder@debian.org> wrote:\n> > diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\n> > index c4dbc2a..9cc8c2f 100644\n> > --- a/Documentation/git-describe.txt\n> > +++ b/Documentation/git-describe.txt\n> > @@ -30,7 +30,8 @@ OPTIONS\n> >  \n> >  --tags::\n> >  \tInstead of using only the annotated tags, use any tag\n> > -\tfound in `.git/refs/tags`.\n> > +\tfound in `.git/refs/tags`. Though if an annotated tag is found in the\n> > +\tancestry, it will always be preferred to lightweight tags.\n> \n> As technically correct as the statement is, I read this and go\n> \"why do we even have --tags?\".\n> \n> If I read builtin-describe.c right we only honor --tags on an exact\n> match, or if there are no annotated tags at all in the history.\n> I wonder if docs like this aren't better for --tags:\n> \n> --tags::\n> \tIf a lightweight tag exactly matches, output it.  If no\n> \tannotated tag is found in the ancestry but a lightweight\n> \ttag is found, output the lightweight tag.\n\nsounds better indeed.\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"91914","messageId":"20080930095641.GA9001@strlen.de","threadId":"15698","inReplyTo":"20080929150127.GB18340@spearce.org","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-09-30T09:56:41Z","receivedAt":"2008-09-30T09:56:41Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"Hello,\n\nOn Mon, Sep 29, 2008 at 08:01:27AM -0700, Shawn O. Pearce wrote:\n> --tags::\n> \tIf a lightweight tag exactly matches, output it.  If no\n> \tannotated tag is found in the ancestry but a lightweight\n> \ttag is found, output the lightweight tag.\nIMHO --tags should behave as Erez expected (because it's what I\nexpected, too).  As --tags currently behaves it's only usable in very\nrare cases (most of the time it only makes a difference on repos without\nany annotated tag).\n\nWhen do you pass --tags?  Only if a lightweight tag is OK for an answer.\nAnd then I would prefer a \"near\" lightweight tag to a \"farer\" annotated\none.\n\nBest regards\nUwe\n"},{"id":"91916","messageId":"48E1FACC.2010204@op5.se","threadId":"15698","inReplyTo":"20080930095641.GA9001@strlen.de","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-30T10:09:16Z","receivedAt":"2008-09-30T10:09:16Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Uwe Kleine-König wrote:\n> Hello,\n> \n> On Mon, Sep 29, 2008 at 08:01:27AM -0700, Shawn O. Pearce wrote:\n>> --tags::\n>> \tIf a lightweight tag exactly matches, output it.  If no\n>> \tannotated tag is found in the ancestry but a lightweight\n>> \ttag is found, output the lightweight tag.\n> IMHO --tags should behave as Erez expected (because it's what I\n> expected, too).  As --tags currently behaves it's only usable in very\n> rare cases (most of the time it only makes a difference on repos without\n> any annotated tag).\n> \n> When do you pass --tags?  Only if a lightweight tag is OK for an answer.\n> And then I would prefer a \"near\" lightweight tag to a \"farer\" annotated\n> one.\n> \n\nThe reason lightweight tags aren't considered is that they're often put\nsomewhere to just mark some refs one wants to keep around, or as a sort\nof movable snapshot marker (we have \"latest/build\", \"latest/tested\" etc\nas lightweight tags). It's nifty to use lw tags for that since they can't\nbe committed to by accident. That doesn't mean we want 'git describe' to\nstart outputting \"latest-build\" whenever we want to pull a version number\nfrom it though.\n\nThis was especially true before the creation of \"git stash\" and the reflog,\nbut quite a lot of people still use them for similar purposes.\n\nIn short; \"git describe\" output stays the way it is, or things will start\nunexpectedly breaking for quite a lot of people.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91970","messageId":"20080930190449.GG21310@spearce.org","threadId":"15698","inReplyTo":"20080930095641.GA9001@strlen.de","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-30T19:04:49Z","receivedAt":"2008-09-30T19:04:49Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Uwe Kleine-KKKnig <ukleinek@strlen.de> wrote:\n> On Mon, Sep 29, 2008 at 08:01:27AM -0700, Shawn O. Pearce wrote:\n> > --tags::\n> > \tIf a lightweight tag exactly matches, output it.  If no\n> > \tannotated tag is found in the ancestry but a lightweight\n> > \ttag is found, output the lightweight tag.\n>\n> IMHO --tags should behave as Erez expected (because it's what I\n> expected, too).  As --tags currently behaves it's only usable in very\n> rare cases (most of the time it only makes a difference on repos without\n> any annotated tag).\n> \n> When do you pass --tags?  Only if a lightweight tag is OK for an answer.\n> And then I would prefer a \"near\" lightweight tag to a \"farer\" annotated\n> one.\n\nI don't disagree.  I've been tempted to write a patch to change the\nbehavior of git-describe so that --tags and --all control what names\nare inserted into the candidate list, but don't control the ordering\nof their selection.\n\nI think this is all that is needed to make the behavior do what you\nand Erez expected.  But its a pretty big change in the results if\nyou are passing in --all or --tags today.\n\n--8<--\n[WIP] Change meaning of --tags and --all\n\n---\n builtin-describe.c |    6 ++----\n 1 files changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex ec404c8..fd54fec 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -15,8 +15,8 @@ static const char * const describe_usage[] = {\n };\n \n static int debug;\t/* Display lots of verbose info */\n-static int all;\t/* Default to annotated tags only */\n-static int tags;\t/* But allow any tags if --tags is specified */\n+static int all;\t/* Any valid ref can be used */\n+static int tags;\t/* Either lightweight or annotated tags */\n static int longformat;\n static int abbrev = DEFAULT_ABBREV;\n static int max_candidates = 10;\n@@ -112,8 +112,6 @@ static int compare_pt(const void *a_, const void *b_)\n {\n \tstruct possible_tag *a = (struct possible_tag *)a_;\n \tstruct possible_tag *b = (struct possible_tag *)b_;\n-\tif (a->name->prio != b->name->prio)\n-\t\treturn b->name->prio - a->name->prio;\n \tif (a->depth != b->depth)\n \t\treturn a->depth - b->depth;\n \tif (a->found_order != b->found_order)\n-- \n1.6.0.2.513.g6dbd\n\n\n-- \nShawn.\n"},{"id":"91991","messageId":"20080930221453.GA13659@strlen.de","threadId":"15698","inReplyTo":"20080930190449.GG21310@spearce.org","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-09-30T22:14:53Z","receivedAt":"2008-09-30T22:14:53Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"Hi Shawn,\n\nOn Tue, Sep 30, 2008 at 12:04:49PM -0700, Shawn O. Pearce wrote:\n> Uwe Kleine-KKKnig <ukleinek@strlen.de> wrote:\n> > On Mon, Sep 29, 2008 at 08:01:27AM -0700, Shawn O. Pearce wrote:\n> > > --tags::\n> > > \tIf a lightweight tag exactly matches, output it.  If no\n> > > \tannotated tag is found in the ancestry but a lightweight\n> > > \ttag is found, output the lightweight tag.\n> >\n> > IMHO --tags should behave as Erez expected (because it's what I\n> > expected, too).  As --tags currently behaves it's only usable in very\n> > rare cases (most of the time it only makes a difference on repos without\n> > any annotated tag).\n> > \n> > When do you pass --tags?  Only if a lightweight tag is OK for an answer.\n> > And then I would prefer a \"near\" lightweight tag to a \"farer\" annotated\n> > one.\n> \n> I don't disagree.  I've been tempted to write a patch to change the\n> behavior of git-describe so that --tags and --all control what names\n> are inserted into the candidate list, but don't control the ordering\n> of their selection.\n> \n> I think this is all that is needed to make the behavior do what you\n> and Erez expected.  But its a pretty big change in the results if\n> you are passing in --all or --tags today.\nBut it matches the documentation, and the expectations of Erez, me and\n(at least initially) Pierre.\n\nMy POV is still:  If you pass --all or --tags you have to be able to\nhandle if a lw tag is used in the answer.\n\n> -static int all;\t/* Default to annotated tags only */\n> -static int tags;\t/* But allow any tags if --tags is specified */\n> +static int all;\t/* Any valid ref can be used */\n> +static int tags;\t/* Either lightweight or annotated tags */\nMmmh, IMHO the comment for tags is misleading, its either annotated only\nor both.\n\nBest regards and thanks,\nUwe\n"},{"id":"91992","messageId":"20080930222646.GP21310@spearce.org","threadId":"15698","inReplyTo":"20080930221453.GA13659@strlen.de","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-30T22:26:46Z","receivedAt":"2008-09-30T22:26:46Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Uwe Kleine-KKKnig <ukleinek@strlen.de> wrote:\n> On Tue, Sep 30, 2008 at 12:04:49PM -0700, Shawn O. Pearce wrote:\n> > Uwe Kleine-KKKnig <ukleinek@strlen.de> wrote:\n> > >\n> > > IMHO --tags should behave as Erez expected (because it's what I\n> > > expected, too).\n> > \n> > I don't disagree.  I've been tempted to write a patch to change the\n> > behavior of git-describe so that --tags and --all control what names\n> > are inserted into the candidate list, but don't control the ordering\n> > of their selection.\n> > \n> > I think this is all that is needed to make the behavior do what you\n> > and Erez expected.  But its a pretty big change in the results if\n> > you are passing in --all or --tags today.\n>\n> But it matches the documentation, and the expectations of Erez, me and\n> (at least initially) Pierre.\n> \n> My POV is still:  If you pass --all or --tags you have to be able to\n> handle if a lw tag is used in the answer.\n\nI was agreeing with you.  I've long felt that the --tags and --all\nbehavior of git-describe was wrong.  But something in the back of\nmy mind tells me Junio felt otherwise.\n\nIts a change in behavior.  Today users are getting annotated tags\nback from `git describe --tags` even if lightweight tags are closer.\nOnce this code change is in they'll start to get lightweight tags.\n\nPreviously `git describe --tags` never gave a lightweight tag if\nthere was at least one annotated tag in the history.  Now it will\nstart to give the lightweight tags.  Some users may see that as a\nbreakage.  Especially after the 1.6 \"dashless\" change...\n\n> > -static int all;\t/* Default to annotated tags only */\n> > -static int tags;\t/* But allow any tags if --tags is specified */\n> > +static int all;\t/* Any valid ref can be used */\n> > +static int tags;\t/* Either lightweight or annotated tags */\n>\n> Mmmh, IMHO the comment for tags is misleading, its either annotated only\n> or both.\n\nOh, yes, right.  Thanks.  I'll clean it up.\n\n-- \nShawn.\n"},{"id":"92768","messageId":"20081010165952.GI8203@spearce.org","threadId":"15698","inReplyTo":"20080930083940.GA11453@artemis.corp","subject":"[RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-10T16:59:52Z","receivedAt":"2008-10-10T16:59:52Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the caller supplies --tags they want the lightweight, unannotated\ntags to be searched for a match.  If a lightweight tag is closer\nin the history, it should be matched, even if an annotated tag is\nreachable further back in the commit chain.\n\nThe same applies with --all when matching any other type of ref.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n This come out of the discussions earlier last week, where folks\n were confused about the meaning of --tags and wanted to see it\n behave as they expected, which was to match the nearest tag,\n no matter its \"type\".\n\n The code is unchanged from what I sent out before, but now it has\n updated test vectors and a commit message.\n\n Thoughts?\n\n builtin-describe.c  |    6 ++----\n t/t6120-describe.sh |    8 ++++----\n 2 files changed, 6 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex ec404c8..fd54fec 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -15,8 +15,8 @@ static const char * const describe_usage[] = {\n };\n \n static int debug;\t/* Display lots of verbose info */\n-static int all;\t/* Default to annotated tags only */\n-static int tags;\t/* But allow any tags if --tags is specified */\n+static int all;\t/* Any valid ref can be used */\n+static int tags;\t/* Either lightweight or annotated tags */\n static int longformat;\n static int abbrev = DEFAULT_ABBREV;\n static int max_candidates = 10;\n@@ -112,8 +112,6 @@ static int compare_pt(const void *a_, const void *b_)\n {\n \tstruct possible_tag *a = (struct possible_tag *)a_;\n \tstruct possible_tag *b = (struct possible_tag *)b_;\n-\tif (a->name->prio != b->name->prio)\n-\t\treturn b->name->prio - a->name->prio;\n \tif (a->depth != b->depth)\n \t\treturn a->depth - b->depth;\n \tif (a->found_order != b->found_order)\ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 16cc635..e6c9e59 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -91,10 +91,10 @@ check_describe D-* HEAD^^\n check_describe A-* HEAD^^2\n check_describe B HEAD^^2^\n \n-check_describe A-* --tags HEAD\n-check_describe A-* --tags HEAD^\n-check_describe D-* --tags HEAD^^\n-check_describe A-* --tags HEAD^^2\n+check_describe c-* --tags HEAD\n+check_describe c-* --tags HEAD^\n+check_describe e-* --tags HEAD^^\n+check_describe c-* --tags HEAD^^2\n check_describe B --tags HEAD^^2^\n \n check_describe B-0-* --long HEAD^^2^\n-- \n1.6.0.2.687.g8544f\n\n-- \nShawn.\n"},{"id":"92769","messageId":"20081010171217.GB29028@artemis.corp","threadId":"15698","inReplyTo":"20081010165952.GI8203@spearce.org","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-10-10T17:12:17Z","receivedAt":"2008-10-10T17:12:17Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Fri, Oct 10, 2008 at 04:59:52PM +0000, Shawn O. Pearce wrote:\n> If the caller supplies --tags they want the lightweight, unannotated\n> tags to be searched for a match.  If a lightweight tag is closer\n> in the history, it should be matched, even if an annotated tag is\n> reachable further back in the commit chain.\n> \n> The same applies with --all when matching any other type of ref.\n> \n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n> \n>  This come out of the discussions earlier last week, where folks\n>  were confused about the meaning of --tags and wanted to see it\n>  behave as they expected, which was to match the nearest tag,\n>  no matter its \"type\".\n> \n>  The code is unchanged from what I sent out before, but now it has\n>  updated test vectors and a commit message.\n> \n>  Thoughts?\n\nI would like to see an enhanced information in the documentation so that\npeople remember that lightweight tags are not meant to be constant over\ntime and that's a bad idea to use them.\n\nWhat the discussion showed, is that the people don't know about\nannotated tags, and git-describe should have a stub of documentation\nthat points to git-tag(1) so that people learn about it.\n\nApart from that, it feels fine.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"92771","messageId":"7vwsggl3ep.fsf@gitster.siamese.dyndns.org","threadId":"15698","inReplyTo":"20081010171217.GB29028@artemis.corp","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-10-10T18:18:38Z","receivedAt":"2008-10-10T18:18:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pierre Habouzit <madcoder@debian.org> writes:\n\n> I would like to see an enhanced information in the documentation so that\n> people remember that lightweight tags are not meant to be constant over\n> time and that's a bad idea to use them.\n>\n> What the discussion showed, is that the people don't know about\n> annotated tags, and git-describe should have a stub of documentation\n> that points to git-tag(1) so that people learn about it.\n>\n> Apart from that, it feels fine.\n\nThe primary mode of operation without --tags of \"describe\" is about coming\nup with version numbers, and as such, it should try to base its output on\nimmutable anchors as much as possible.  For that reason, I think it should\nuse \"tag \" line from the tag object, not the name of the ref, to describe\nthe committish.  They should match (otherwise fsck would say something\nabout it) in practice, though...\n\nThe patch is about --tags, which is not about such a strict \"version\nnumber\" generation, but about \"come up with a closest ref\", so in that\nlight it feels perfectly fine.\n"},{"id":"92814","messageId":"48F12CF8.505@op5.se","threadId":"15698","inReplyTo":"20081010165952.GI8203@spearce.org","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-10-11T22:47:20Z","receivedAt":"2008-10-11T22:47:20Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Shawn O. Pearce wrote:\n> If the caller supplies --tags they want the lightweight, unannotated\n> tags to be searched for a match.  If a lightweight tag is closer\n> in the history, it should be matched, even if an annotated tag is\n> reachable further back in the commit chain.\n> \n> The same applies with --all when matching any other type of ref.\n> \n\nIn 99% of the cases, \"--all\" will then give back the currently\nchecked out branch unless a revision is specified, right?\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"92859","messageId":"20081012180040.GC4856@spearce.org","threadId":"15698","inReplyTo":"48F12CF8.505@op5.se","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-12T18:00:40Z","receivedAt":"2008-10-12T18:00:40Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Andreas Ericsson <ae@op5.se> wrote:\n> Shawn O. Pearce wrote:\n>> If the caller supplies --tags they want the lightweight, unannotated\n>> tags to be searched for a match.  If a lightweight tag is closer\n>> in the history, it should be matched, even if an annotated tag is\n>> reachable further back in the commit chain.\n>>\n>> The same applies with --all when matching any other type of ref.\n>>\n>\n> In 99% of the cases, \"--all\" will then give back the currently\n> checked out branch unless a revision is specified, right?\n\nYup.\n\n`git describe --all` or `git describe --all HEAD`\n\nwould kick back the current branch you have checked out, assuming\nyou have a real branch under refs/heads and not some detached HEAD.\n\nIMHO, that's what the user asked for.\n\n-- \nShawn.\n"},{"id":"92861","messageId":"48F23E43.4010409@op5.se","threadId":"15698","inReplyTo":"20081012180040.GC4856@spearce.org","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-10-12T18:13:23Z","receivedAt":"2008-10-12T18:13:23Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Shawn O. Pearce wrote:\n> Andreas Ericsson <ae@op5.se> wrote:\n>> Shawn O. Pearce wrote:\n>>> If the caller supplies --tags they want the lightweight, unannotated\n>>> tags to be searched for a match.  If a lightweight tag is closer\n>>> in the history, it should be matched, even if an annotated tag is\n>>> reachable further back in the commit chain.\n>>>\n>>> The same applies with --all when matching any other type of ref.\n>>>\n>> In 99% of the cases, \"--all\" will then give back the currently\n>> checked out branch unless a revision is specified, right?\n> \n> Yup.\n> \n> `git describe --all` or `git describe --all HEAD`\n> \n> would kick back the current branch you have checked out, assuming\n> you have a real branch under refs/heads and not some detached HEAD.\n> \n> IMHO, that's what the user asked for.\n> \n\nTrue. I think this will raise questions of its usability though,\nin particular if it considers remote branches too.\n\nOtoh, I've never seen the use for \"git describe --all\" earlier\neither, so I guess I think differently from those who want this\nfeature.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"92863","messageId":"20081012182913.GA8858@strlen.de","threadId":"15698","inReplyTo":"20081010165952.GI8203@spearce.org","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-10-12T18:29:13Z","receivedAt":"2008-10-12T18:29:13Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"On Fri, Oct 10, 2008 at 09:59:52AM -0700, Shawn O. Pearce wrote:\n> If the caller supplies --tags they want the lightweight, unannotated\n> tags to be searched for a match.  If a lightweight tag is closer\n> in the history, it should be matched, even if an annotated tag is\n> reachable further back in the commit chain.\n> \n> The same applies with --all when matching any other type of ref.\n> \n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n> \n>  This come out of the discussions earlier last week, where folks\n>  were confused about the meaning of --tags and wanted to see it\n>  behave as they expected, which was to match the nearest tag,\n>  no matter its \"type\".\n> \n>  The code is unchanged from what I sent out before, but now it has\n>  updated test vectors and a commit message.\n> \n>  Thoughts?\nAs I already told earlier, this is exactly how I would expect it.\n\n>  static int debug;\t/* Display lots of verbose info */\n> -static int all;\t/* Default to annotated tags only */\n> -static int tags;\t/* But allow any tags if --tags is specified */\n> +static int all;\t/* Any valid ref can be used */\n> +static int tags;\t/* Either lightweight or annotated tags */\nMaybe the last comment should better read:\n\n\t/* allow lightweight tags */\n\n?  Apart from this one nitpick:\n\nAcked-By: Uwe Kleine-König <ukleinek@strlen.de>\n\nThanks\nUwe\n"},{"id":"92935","messageId":"20081013143202.GO4856@spearce.org","threadId":"15698","inReplyTo":"7vwsggl3ep.fsf@gitster.siamese.dyndns.org","subject":"Re: [RFC PATCH] describe: Make --tags and --all match lightweight tags more often","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-13T14:32:02Z","receivedAt":"2008-10-13T14:32:02Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> \n> The primary mode of operation without --tags of \"describe\" is about coming\n> up with version numbers, and as such, it should try to base its output on\n> immutable anchors as much as possible.  For that reason, I think it should\n> use \"tag \" line from the tag object, not the name of the ref, to describe\n> the committish.  They should match (otherwise fsck would say something\n> about it) in practice, though...\n\nFWIW the use of \"tag \" line for an annotated tag being output is what\n212945d4 (Teach git-describe to verify annotated tag names before\noutput) was all about.  That has been in tree since v1.5.5-rc0~86^2.\n\nSo we already are doing (have been doing) exactly what you are\nasking for.\n\nOr did I misunderstand you?\n\n-- \nShawn.\n"},{"id":"92936","messageId":"20081013143946.GP4856@spearce.org","threadId":"15698","inReplyTo":"20081010171217.GB29028@artemis.corp","subject":"[PATCH v2] describe: Make --tags and --all match lightweight tags more often","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-13T14:39:46Z","receivedAt":"2008-10-13T14:39:46Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the caller supplies --tags they want the lightweight, unannotated\ntags to be searched for a match.  If a lightweight tag is closer\nin the history, it should be matched, even if an annotated tag is\nreachable further back in the commit chain.\n\nThe same applies with --all when matching any other type of ref.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\nAcked-By: Uwe Kleine-K�nig <ukleinek@strlen.de>\n---\n Changes since v1 of this patch:\n\n - Documentation updates were added.\n - Comment for \"tags\" flag modified per Uwe's suggestion.\n\n Documentation/git-describe.txt |    9 +++++++--\n builtin-describe.c             |    6 ++----\n t/t6120-describe.sh            |    8 ++++----\n 3 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\nindex c4dbc2a..40e061f 100644\n--- a/Documentation/git-describe.txt\n+++ b/Documentation/git-describe.txt\n@@ -18,6 +18,9 @@ shown.  Otherwise, it suffixes the tag name with the number of\n additional commits on top of the tagged object and the\n abbreviated object name of the most recent commit.\n \n+By default (without --all or --tags) `git describe` only shows\n+annotated tags.  For more information about creating annoated tags\n+see the -a and -s options to linkgit:git-tag[1].\n \n OPTIONS\n -------\n@@ -26,11 +29,13 @@ OPTIONS\n \n --all::\n \tInstead of using only the annotated tags, use any ref\n-\tfound in `.git/refs/`.\n+\tfound in `.git/refs/`.  This option enables matching\n+\tany known branch, remote branch, or lightweight tag.\n \n --tags::\n \tInstead of using only the annotated tags, use any tag\n-\tfound in `.git/refs/tags`.\n+\tfound in `.git/refs/tags`.  This option enables matching\n+\ta lightweight (non-annotated) tag.\n \n --contains::\n \tInstead of finding the tag that predates the commit, find\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex ec404c8..d2cfb1b 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -15,8 +15,8 @@ static const char * const describe_usage[] = {\n };\n \n static int debug;\t/* Display lots of verbose info */\n-static int all;\t/* Default to annotated tags only */\n-static int tags;\t/* But allow any tags if --tags is specified */\n+static int all;\t/* Any valid ref can be used */\n+static int tags;\t/* Allow lightweight tags */\n static int longformat;\n static int abbrev = DEFAULT_ABBREV;\n static int max_candidates = 10;\n@@ -112,8 +112,6 @@ static int compare_pt(const void *a_, const void *b_)\n {\n \tstruct possible_tag *a = (struct possible_tag *)a_;\n \tstruct possible_tag *b = (struct possible_tag *)b_;\n-\tif (a->name->prio != b->name->prio)\n-\t\treturn b->name->prio - a->name->prio;\n \tif (a->depth != b->depth)\n \t\treturn a->depth - b->depth;\n \tif (a->found_order != b->found_order)\ndiff --git a/t/t6120-describe.sh b/t/t6120-describe.sh\nindex 16cc635..e6c9e59 100755\n--- a/t/t6120-describe.sh\n+++ b/t/t6120-describe.sh\n@@ -91,10 +91,10 @@ check_describe D-* HEAD^^\n check_describe A-* HEAD^^2\n check_describe B HEAD^^2^\n \n-check_describe A-* --tags HEAD\n-check_describe A-* --tags HEAD^\n-check_describe D-* --tags HEAD^^\n-check_describe A-* --tags HEAD^^2\n+check_describe c-* --tags HEAD\n+check_describe c-* --tags HEAD^\n+check_describe e-* --tags HEAD^^\n+check_describe c-* --tags HEAD^^2\n check_describe B --tags HEAD^^2^\n \n check_describe B-0-* --long HEAD^^2^\n-- \n1.6.0.2.706.g340fc\n\n-- \nShawn.\n"},{"id":"93090","messageId":"adf1fd3d0810150554k65f66932la30e42e93131a7a8@mail.gmail.com","threadId":"15698","inReplyTo":"20081013143946.GP4856@spearce.org","subject":"Re: [PATCH v2] describe: Make --tags and --all match lightweight tags more often","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2008-10-15T12:54:14Z","receivedAt":"2008-10-15T12:54:14Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"> diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt\n> index c4dbc2a..40e061f 100644\n> --- a/Documentation/git-describe.txt\n> +++ b/Documentation/git-describe.txt\n\n[...]\n\n> +annotated tags.  For more information about creating annoated tags\n\ns/annoated/annotated/\n\nSanti\n"},{"id":"93132","messageId":"20081015200534.GA32686@strlen.de","threadId":"15698","inReplyTo":"20080930222646.GP21310@spearce.org","subject":"Re: [PATCH] doc: enhance git describe --tags help","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-10-15T20:05:34Z","receivedAt":"2008-10-15T20:05:34Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"Hi Shawn,\n\nOn Tue, Sep 30, 2008 at 03:26:46PM -0700, Shawn O. Pearce wrote:\n> Its a change in behavior.  Today users are getting annotated tags\n> back from `git describe --tags` even if lightweight tags are closer.\n> Once this code change is in they'll start to get lightweight tags.\n>\n> Previously `git describe --tags` never gave a lightweight tag if\n> there was at least one annotated tag in the history.  Now it will\n> start to give the lightweight tags.  Some users may see that as a\n> breakage.\nRight, and previously `git describe` didn't differ from `git describe\n--tags` in the presence of at least one annotated tag.  This is the main\nreason for me to believe that this breakage doesn't hurt that much.\n\n>            Especially after the 1.6 \"dashless\" change...\nI didn't get why the \"dashless\" change is relevant here.  IMHO this one\nis/was harder for the user because it changed every command, and they\nhad to start using bash completion if they didn't before.  This one\nshould only hurt the users of \"git describe --tags\", and I assume there\nare not that many.  Still more as the documentation describes the\nbehaviour the patch implements.\n\nBest regards\nUwe\n"}]}