Subject: Re: [BUG] `git describe` doesn't traverse the graph in topological order

From: 'Ben Boeckel' <[email-masked]>
Date: Fri, 22 Sep 2023 13:38:34 -0400

On Fri, Sep 22, 2023 at 13:14:30 -0400, [email-masked] wrote:
> On Friday, September 22, 2023 12:51 PM, Ben Boeckel wrote:
> >On Fri, Sep 22, 2023 at 12:13:00 -0400, [email-masked] wrote:
> >> On Friday, September 22, 2023 11:40 AM, Ben Boeckel wrote:
> >> >On Sat, Aug 12, 2023 at 15:36:56 -0400, Ben Boeckel wrote:
> >> >> I found an issue where `git describe` doesn't find a "closer" tag
> >> >> than another tag as the correct one to base the description off of.
> >> >> I have a reproducer, but I'll first give details of the real world issue.
> >> >
> >> >Bump. Can anyone provide guidance as to what the best solution to this might be?
> >>
> >> Can you provide details? `git describe` is sensitive to --first-parent
> >> and whether the tag has annotations.
> >
> >I provided more details and a reproducer in the original email:
> >
> >    https://lore.kernel.org/git/ZNffWAgldUZdpQcr@farprobe/T/#u
> 
> As I indicated, the command is sensitive to --first-parent. For example:
> 
> $ git describe
> v9.3.0.rc0-520-g1339e86833
> $ git describe --first-parent
> v9.0.0.rc1-5143-g1339e86833

Sorry, but this is just even more confusing to me as neither tag is on
the first-parent history of `HEAD`.

> You have multiple parents in your tree of HEAD. This is probably
> confusing the interpretation. The most closely connected tag to HEAD
> is v9.3.0.rc0, from what I can read from your tree. Dates and times of
> the commit do not participate in this determination, to my knowledge.
> You can force selection of a subset of tags by specifying the
> --match=pattern argument.

I don't see how that is possible since v9.3.0.rc0 is v9.3.0.rc1~2. Note
the "not on the tag" commit count for the descriptions being wildly
different.

> There appears to be a merge at 446120fd88 which brings v9.3.0.rc0
> closer to HEAD than v9.3.0.rc1.

That is still giving an incorrect description as there are *fewer*
commits not on rc1 than rc0 relative to HEAD (as rc0 is an ancestor of
rc1).

Thanks,

--Ben