In a private repository, I have set of tags which are mostly linear
(each tag contains the previous one). I have created this repo with
fast-export --anonomize to reproduce the issue and it is available at
https://github.com/tarm/git_describe_repo.
Recently I ran git describe, but I did not get the most recent tag and
instead got the previous tag. The HEAD commit contains both the older
and newer tagged commits, but for some reason chooses the older tag
which is farther away. There is no tag that is an exact match.
Looking at the documentation for git-describe, I see this:
If multiple tags were found during the walk then the tag which
has the fewest commits different from the input commit-ish will
be selected and output. Here fewest commits different is
defined as the number of commits which would be shown by git
log tag..input will be the smallest number of commits possible.
However, that is not what I actually see.
$ git checkout 8630841ef
$ git describe --debug --always --tags HEAD
searching to describe HEAD
finished search at 10b2bfb88802917b37c93620ae62cc2dca603425
lightweight 134 v1.6
annotated 439 v1.5
annotated 534 v1.4
lightweight 553 v1.7
traversed 577 commits
v1.6-134-g8630841
In particular, I actually expected git-describe to choose commit v1.7
as the base since the tags are in order:
$ git log --format=oneline v1.7..HEAD|wc -l
34
$ git log --format=oneline v1.6..HEAD|wc -l
134
$ git log --format=oneline v1.5..HEAD|wc -l
439
$ git log --format=oneline v1.4..HEAD|wc -l
534
I have tried this with the latest git.git HEAD (1d88dab) and see the
same issue. Am I missing something about how git-describe chooses the
tag or is git-describe not behaving as documented?
Thanks,
Tarm
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html