git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git describe unexpected results

From
TTarmigan <tarmigan+git@gmail.com>
Date
Dec 22, 2015, 07:03 UTC
Message-ID
<CAE1MmuE_aqO-JhXTyz-SRkm15uxcukveYTTd2W71R2Mp26oRhw@mail.gmail.com>

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

Message 1 of 1 in “git describe unexpected results”
  1. TarmiganDec 22, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.