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

Re: setlocalversion wasn't producing git labels for bisect

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 30, 2008, 20:07 UTC
Message-ID
<7vbpzagtb7.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<48B9A2C7.3080001@dgreaves.com>
David Greaves <david@dgreaves.com> writes:
Show 9 quoted lines
> Running
>   git name-rev --tags HEAD
> gives the output
>   HEAD tags/v2.6.27-rc4~44^2
>
> This isn't matched by setlocalversion regexp so it makes it harder to make deb-pkg/install/grub/reboot/remove
>
> Of course if this patch is accepted it is going to make life complicated when bisecting around it.
> Maybe git should behave as the man page suggests and have the ^X before the ~nnn? (maybe it has been fixed already)
Sorry, I don't understand what you are trying to fix here.

Your head can be reached by going 44 generations back (following the first parent chain) from v2.6.27-rc4, which is a merge commit, and then taking its second parent. IOW the name-rev output you quoted represents this history:

                                  v2.6.27-rc4
       ----o---o---o---....---o---o
          /^                  ^
         / v2.6.27-rc4~44     v2.6.27-rc4~1
        o
        ^ Your HEAD

Swapping ^X and ~nnn changes the meaning completely. v2.6.27-rc4^2~44 is the 44 generation ancestor of the second parent of -rc4, but v2.6.27-rc4 is *NOT* a merge and it does not have the second parent.

>   http://www.kernel.org/pub/software/scm/git/docs/v1.5.6.5/git-name-rev.html
> shows an example:
>   33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99^0~940
This says
    v0.99 is a tag, and dereference it (^0) to get to the commit that
    points at it, and then the commit in question (33db5f) is its 940th
    generation ancestor.

We used to explicitly say "it is a tag and dereference it" by adding ^0 but since Feb 2007 we stopped doing so because taking its 940th parent can only be done to a commit, so v0.99~940 and v0.99^0~940 are equivalent.

We should fix the documentation, though.
Previous: David GreavesNext: Junio C Hamano
Message 2 of 5 in “setlocalversion wasn't producing git labels for bisect”
  1. David GreavesAug 30, 2008
  2. Junio C HamanoAug 30, 2008
  3. Fix example in git-name-rev documentationJunio C Hamano, Aug 30, 2008
  4. Johannes SchindelinSep 1, 2008
  5. [Regression] Re: setlocalversion wasn't producing git labels for bisectDavid Greaves, Aug 31, 2008

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.