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

Re: "git describe --debug" does not show the latest tag for "groff"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 28, 2021, 08:26 UTC
Message-ID
<211028.86wnlxwnqt.gmgdl@evledraar.gmail.com>
In-Reply-To
<20211027233101.GA762862@rhi.hi.is>
On Wed, Oct 27 2021, Bjarni Ingi Gislason wrote:
Show 74 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
>
>   I do not know, it could have happened anytime after the latest tag
> was committed (11th Nov. 2020).
>
> What did you expect to happen? (Expected behavior)
>
>   Seeing the latest tag "1.23.0.rc1" in the version string of "groff"
> (and in the output of "git describe --debug")
>
> What happened instead? (Actual behavior)
>
>   "groff --version" shows for example "1.22.4.3317-8f8c8-dirty"
>
>   "git describe --debug" shows:
>
> describe HEAD
> No exact match on refs or tags, searching to describe
> finished search at 2ac1f9ba5578cad27dc547d5be3c91753db436ea
>  annotated       3318 1.22.4
>  annotated       3319 1.22.4.rc5
>  annotated       3352 1.22.4.rc4
>  annotated       3464 1.22.4.rc3
>  annotated       3485 1.23.0.rc1
>  annotated       3572 1.22.4.rc2
>  annotated       3619 1.22.3.rc1
> traversed 3833 commits
> 1.22.4-3318-g3a1e750d
>
> What's different between what you expected and what actually happened?
>
>   The latest tag is not shown for the groff version.
>
> Anything else you want to add:
>
>
>   The latest tag in "git log" is 1.23.0.rc1 in my branch.
>   It is 1.23.0.rc1 in branch master.
>
>   Search for "tag:" in "git log" in my branch shows:
>
> commit c05b538c504106d55b81caa6400ea80797f03775 (tag: 1.23.0.rc1)
> Author: Bertrand Garrigues <...>
> Date:   Wed Nov 11 01:58:55 2020 +0100
>
>   "git show-ref 1.23.0.rc1" in my branch shows:
>
> faa3dff8d011e61721e763c71b6ccbf20a4675bc refs/tags/1.23.0.rc1
>
> ####
>
>   "git-version-gen" (gnulib) does not get the latest tag.
>
>   The call in configure.am is:
>
> AC_INIT([GNU Troff],[m4_esyscmd(build-aux/git-version-gen --prefix ""
> .tarball-version)],[http://savannah.gnu.org/bugs/?group=g$
>
>   The files ".git/packed-refs" and ".git/info/refs" are the same in both
> branches.
>
> #####
>
> [System Info]
> git version 2.33.0 (Debian/testing Version: 1:2.33.0-1)
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.14.9-2 #1 SMP Sun Oct 10 01:53:44 UTC 2021 x86_64
> compiler info: gnuc: 10.2
> libc info: glibc: 2.32
> $SHELL (typically, interactive shell): /bin/bash
Daginn.

The "git describe" command won't just return the latest tag name, but if you're not on such an exact tag name find the "closest", and then add a suffix indicating the distance and HEAD commit.

Reading between the lines I think you know that, but you're suprised that it's finding 1.22.4 instead of 1.23.0.rc1, which newer.

I tried to reproduce this and cloned
https://git.savannah.gnu.org/git/groff.git; If you run e.g. this
command:
    
    $ for c in $(git log --oneline 1.22.4..1.23.0.rc1 | awk '{print $1}'); do git describe $c; done
    1.23.0.rc1
    1.22.4-765-g10cd0b66
    1.22.4-764-ge3b774ad
    1.22.4-763-gfb52df3b
    1.22.4-762-g0f42ca27
    1.22.4-761-gdf73fc2b
    1.22.4-760-g3afeb883
    1.22.4-759-gcb1a9dc5
    [...]
You'll see us describing all commits between 1.22.4..1.23.0-rc0, ending with:
    
    [...]
    1.22.4-7-g72b4440e
    1.22.4-6-g81908bc0
    1.22.4-5-g9da68905
    1.22.4-4-g2212cba0
    1.22.4-3-ga3068bfd
    1.22.4-2-g607236cc
    1.22.4-1-gde9f9bfd

But as your tag "1.22.4.3317-8f8c8-dirty" shows we're at a distance of 3317 from 1.22.4. Are you able to share whatever your 8f8c8 is somewhere? I wonder if you're on some commit based off an older version.

Aside from what ref "describe" picked it's weird that a new version of git would choose to show a 5-character hex abbreviation of the commit, the minimum we show these days is 7, unless you have something setting e.g. this in config:

    core.abbrev=5
Or maybe that AC_INIT() macro does that somehow...
Previous: Bjarni Ingi GislasonNext: Bjarni Ingi Gislason
Message 2 of 4 in “"git describe --debug" does not show the latest tag for "groff"”
  1. Bjarni Ingi GislasonOct 27, 2021
  2. Ævar Arnfjörð BjarmasonOct 28, 2021
  3. Bjarni Ingi GislasonOct 30, 2021
  4. Chris TorekOct 31, 2021

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.