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

Re: can git-describe learn first-parent behavior?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 21, 2010, 12:10 UTC
Message-ID
<4C98A0B7.9050501@drmicha.warpmail.net>
In-Reply-To
<4C989E6B.1070703@viscovery.net>
Johannes Sixt venit, vidit, dixit 21.09.2010 14:00:
Show 21 quoted lines
> Am 9/21/2010 13:49, schrieb Michael J Gruber:
>> Johannes Sixt venit, vidit, dixit 21.09.2010 12:03:
>>> git describe e5498e8a^2 e5498e8a^1~24 e5498e8a
>>> v1.7.0.7
>>> v1.7.1.1
>>> v1.7.1.1-38-ge5498e8
>>>
>>> v1.7.1.1 is 25 commits away, while v1.7.0.7 is a parent (the second).
>>>
>>> AFAICS, git-describe does The Right Thing (--first-parent).
>>
>> I'm not saying it does the wrong thing. I'm saying it does not do
>> --first-parent but depth priority (where depth is a bit complicated),
>> which may or may not be the same as first-parent transversal/priority.
>> You picked one case where they coincide:
>>
>> git describe --debug e5498e8a^2 e5498e8a^2~24 e5498e8a
>> v1.7.0.7
>> v1.7.0.5
> 
> This should be "v1.7.1.1", no?

Well, e5498e8a^2~24 == v1.7.0.5 and e5498e8a^1~24 == v1.7.1.1. The copy&paste from your e-mail was not exactly helped by Thunderbirds conversion of ^2, ^1 into exponents... In any case, the numbers below are what matters:

Show 23 quoted lines
> 
>> searching to describe e5498e8a
>>  annotated         38 v1.7.1.1
>>  annotated        252 v1.7.1
>>  annotated        268 v1.7.1-rc2
>>  annotated        318 v1.7.1-rc1
>>  annotated        355 v1.7.1-rc0
>>  annotated        478 v1.7.0.7
>>  annotated        492 v1.7.0.6
>>  annotated        512 v1.7.0.5
>>  annotated        539 v1.7.0.4
>>  annotated        564 v1.7.0.3
>> traversed 1267 commits
>> more than 10 tags found; listed 10 most recent
>> gave up search at 97222d9634b5518cd3d328aa86b52746a16334a7
>> v1.7.1.1-38-ge5498e8
>>
>> v1.7.1.1 clearly wins by depth priority.
> 
> If "depth priority" is not the shortest ancestry path (and it obviously is
> not given the numbers above), what is it then, and why does it not work
> with Joshua's example? Wouldn't it be better to make it Just Work instead
> of adding a workaround that has to be enabled manually?

I don't consider the existing behaviour wrong, though it may be a bit tough to figure out. It may even be that the depth calculation has an off-by-1 error which leads to this behaviour.

Consequently, I don't consider --first-parent a workaround. Note that with --first-parent, tags on other branches are not even considered so that you can be sure to get a first parent tag or none.

Do you really think that changing the algorithm would be accepted? In any case, at most that would lead to prioritizing first parent tags unconditionally but still resorting to other tags when there are no first-parent tags.

Michael
Previous: Johannes SixtNext: Johannes Sixt
Message 7 of 12 in “can git-describe learn first-parent behavior?”
  1. Joshua ShraderSep 21, 2010
  2. Michael J GruberSep 21, 2010
  3. git-describe: introduce --first-parentMichael J Gruber, Sep 21, 2010
  4. Johannes SixtSep 21, 2010
  5. Michael J GruberSep 21, 2010
  6. Johannes SixtSep 21, 2010
  7. Michael J GruberSep 21, 2010
  8. Johannes SixtSep 21, 2010
  9. Michael J GruberSep 21, 2010
  10. Joshua ShraderSep 21, 2010
  11. Michael J GruberSep 22, 2010
  12. Joshua ShraderSep 22, 2010

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.