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

Re: [PATCH] peel_onion(): add support for <rev>^{tag}

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 19, 2013, 18:38 UTC
Message-ID
<7vvc5aymhd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1371605946-32565-1-git-send-email-rhansen@bbn.com>
Richard Hansen <rhansen@bbn.com> writes:
> gitrevisions(7) implies that <rev>^{tag} should work,...
Does it?  Is it possible that that should be fixed?
What does it even _mean_ to peel something to a TAG?

A commit, a tree or a blob cannot be peeled to a tag---none of them can contain a tag.

When you have a tag that points at something else, what you have is already a tag, so <that-tag>^{tag} would be <that-tag> itself.

Even more confusingly, when you have a tag that points at another tag, what does <that-outer-tag>^{tag} mean? The outer tag itself, or do you need to peel at least once to reveal the inner-tag? What if that inner-tag points at yet another tag?

The patch does not touch peel_to_type(), so your answer to the above question seems to be "if T is already a tag, T^{tag} is T itself", but then that operation does not look all that useful.

Confused...
Show 13 quoted lines
> diff --git a/sha1_name.c b/sha1_name.c
> index 90419ef..68fd0e4 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -677,6 +677,8 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
>  	sp++; /* beginning of type name, or closing brace for empty */
>  	if (!strncmp(commit_type, sp, 6) && sp[6] == '}')
>  		expected_type = OBJ_COMMIT;
> +	else if (!strncmp(tag_type, sp, 3) && sp[3] == '}')
> +		expected_type = OBJ_TAG;
>  	else if (!strncmp(tree_type, sp, 4) && sp[4] == '}')
>  		expected_type = OBJ_TREE;
>  	else if (!strncmp(blob_type, sp, 4) && sp[4] == '}')
Previous: Richard HansenNext: Richard Hansen
Message 2 of 5 in “peel_onion(): add support for <rev>^{tag}”
  1. peel_onion(): add support for <rev>^{tag}Richard Hansen, Jun 19, 2013
  2. Junio C HamanoJun 19, 2013
  3. Richard HansenJun 19, 2013
  4. Junio C HamanoJun 20, 2013
  5. Ramkumar RamachandraJun 20, 2013

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.