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

Re: [RFD/BUG?] git show with tree/commit

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2016, 16:26 UTC
Message-ID
<xmqq4mb6sshz.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<570D154D.6090006@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 12 quoted lines
> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:
> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:
>
> .gitattributes
> .gitignore
> .mailmap
> ...
>
> While it's clear to me what's going on, I'm wondering whether it's a
> good idea that "git show" says "tree" in front of the unresolved
> treeish, whether it's a tree, a commit or something else. I think it's
> pretty confusing.

There is no "unresolved treeish" on the line that begins with "tree", but I suspect it wasn't very clear to you because of the way you gave the command its input; notice the line in question ends with a colon, which is unfortunate, but it turns out that it is your fault ;-). Read on.

Show 5 quoted lines
> Alternatives would be:
>
> tree <resolved tree id> # here: 040...
> treeish <treeish>	# here: "treeish cab2c..."
> tree <treeish>^{tree} 	# here: "tree cab2c^{tree}"
So, the three choices are
 (1) resolve the tree object name to 40-hex and show it as
     "tree <object name in hex>"
 (2) given an object that is not a tree, show it as "treeish <object
     name>" 
 (3) do not do anything fancy, just show it as "tree <object name>"
     using what the user gave us.

I think the current output is doing the third one (notice the colon at the end of the line).

    $ git show master: | head -n 1
    $ git show master^{tree} | head -n 1
    $ git show cab2cdadf: | head -n 1
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 6 in “[RFD/BUG?] git show with tree/commit”
  1. Michael J GruberApr 12, 2016
  2. Junio C HamanoApr 12, 2016
  3. Michael J GruberApr 13, 2016
  4. Michael J GruberApr 13, 2016
  5. Jeff KingApr 12, 2016
  6. Junio C HamanoApr 12, 2016

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.