{"thread":{"id":"41058","subject":"git describe unexpected results","startedAt":"2015-12-22T07:03:20Z","lastAt":"2015-12-22T07:03:20Z","messageCount":1,"participants":["Tarmigan"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"274842","messageId":"CAE1MmuE_aqO-JhXTyz-SRkm15uxcukveYTTd2W71R2Mp26oRhw@mail.gmail.com","threadId":"41058","inReplyTo":null,"subject":"git describe unexpected results","fromName":"Tarmigan","fromEmail":"tarmigan+git@gmail.com","sentAt":"2015-12-22T07:03:20Z","receivedAt":"2015-12-22T07:03:20Z","isPatch":false,"sender":{"key":"tarmigan+git@gmail.com","avatar":null},"body":"In a private repository, I have set of tags which are mostly linear\n(each tag contains the previous one). I have created this repo with\nfast-export --anonomize to reproduce the issue and it is available at\nhttps://github.com/tarm/git_describe_repo.\n\nRecently I ran git describe, but I did not get the most recent tag and\ninstead got the previous tag.  The HEAD commit contains both the older\nand newer tagged commits, but for some reason chooses the older tag\nwhich is farther away.  There is no tag that is an exact match.\n\nLooking at the documentation for git-describe, I see this:\n\n       If multiple tags were found during the walk then the tag which\n       has the fewest commits different from the input commit-ish will\n       be selected and output. Here fewest commits different is\n       defined as the number of commits which would be shown by git\n       log tag..input will be the smallest number of commits possible.\n\nHowever, that is not what I actually see.\n\n$ git checkout 8630841ef\n$ git describe --debug --always --tags HEAD\nsearching to describe HEAD\nfinished search at 10b2bfb88802917b37c93620ae62cc2dca603425\nlightweight      134 v1.6\nannotated        439 v1.5\nannotated        534 v1.4\nlightweight      553 v1.7\ntraversed 577 commits\nv1.6-134-g8630841\n\nIn particular, I actually expected git-describe to choose commit v1.7\nas the base since the tags are in order:\n\n$ git log --format=oneline v1.7..HEAD|wc -l\n34\n$ git log --format=oneline v1.6..HEAD|wc -l\n134\n$ git log --format=oneline v1.5..HEAD|wc -l\n439\n$ git log --format=oneline v1.4..HEAD|wc -l\n534\n\nI have tried this with the latest git.git HEAD (1d88dab) and see the\nsame issue.  Am I missing something about how git-describe chooses the\ntag or is git-describe not behaving as documented?\n\nThanks,\nTarm\n"}]}