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

Re: name-ref on annotated-tags is null terminated, but lightweight tags arent

From
MRMax Resnick <max.resnick@forgerock.com>
Date
Jun 5, 2020, 17:16 UTC
Message-ID
<20200605171607.rducvc4xretxacn5@forgemax.local>
In-Reply-To
<xmqqa71ho34p.fsf@gitster.c.googlers.com>
Thanks Junio for the quick response.
> Presumably the long hexadecimal are supposed to be on the same line 
> as the "name-rev" command itself?                                   
Yes, sorry I didn't see that the formatting was broken before I sent.
> The suffix "^0" (which has nothing to do 
> with null-termination) means "I do not mean the tag object itself, 
> but the object that is pointed by it".                             

Ok, thanks. I need to unpack that a bit more. I tried to dig around in the man to see if there was indication if that's what was expected but didn't find anything at less for name-rev.

On 20/06/05 10:04AM, Junio C Hamano wrote:
Show 31 quoted lines
> Max Resnick <max.resnick@forgerock.com> writes:
> 
> > What did you do before the bug happened? (Steps to reproduce your issue)
> > I was using name-rev to resolve a commits tag name. Annotated tags seem
> > to have a null termination and lightweight tags dont.
> 
> > ❯ git name-rev --tag --name-only
> > 38bdebc9107cab4ab3718d0581632702e74d9209
> > annotated-tag^0
> >
> > /tmp/null-termination-issue on  master
> > ❯ git name-rev --tag --name-only
> > a340894d3ee655ae6c336a85b42d2215d52609e3
> > lightweight-tag
> 
> Presumably the long hexadecimal are supposed to be on the same line
> as the "name-rev" command itself?
> 
> There is nothing broken in the above output.  The anotated tag
> (annotated-tag in your example) is an object that merely points at
> another object (in which case, the object whose name is 38bdebc9,
> which I guess would be a commit) and it itself has an object name
> different from 38bdebc9.  The suffix "^0" (which has nothing to do
> with null-termination) means "I do not mean the tag object itself,
> but the object that is pointed by it".
> 
> On the other hand, your lightweight-tag is directly pointing at the
> object a340894d, so saying "lightweight-tag" is sufficient, as there
> is no extra layer of indirection (i.e. a tag object) involved.
> 
> Hope it helps.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “name-ref on annotated-tags is null terminated, but lightweight tags arent”
  1. Max ResnickJun 5, 2020
  2. Junio C HamanoJun 5, 2020
  3. Max ResnickJun 5, 2020
  4. Junio C HamanoJun 5, 2020

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.