git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [RFD/BUG?] git show with tree/commit
Date: Wed, 13 Apr 2016 10:02:49 +0200	[thread overview]
Message-ID: <570DFD29.9090100@drmicha.warpmail.net> (raw)
In-Reply-To: <xmqq4mb6sshz.fsf@gitster.mtv.corp.google.com>

Junio C Hamano venit, vidit, dixit 12.04.2016 18:26:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> $ 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.

Guess what, I know the difference between "git show <commit>" and git
show <commit>:"...

>> 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.

(3) ist not quite what I'm after, but I guess when "git show" receives
"<commit>:" there is no way it could trace back that tree reference to
the commit. In fact, (3) is what we have now.

> 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
> 

I confess that I failed to copy the trailing ":" from the original
output... So that one is my fault.

In fact, while specifying "<commit>:" knowingly to show the tree, I
interpreted the ":" in the output as a simple colon introducing the
following output, at least at first glance.

I guess (1) would be the only option that would help (because
"<commit>:" is a tree, not a non-tree treeish).

Michael

  reply	other threads:[~2016-04-13  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 15:33 [RFD/BUG?] git show with tree/commit Michael J Gruber
2016-04-12 16:26 ` Junio C Hamano
2016-04-13  8:02   ` Michael J Gruber [this message]
2016-04-13  9:41     ` Michael J Gruber
2016-04-12 16:34 ` Jeff King
2016-04-12 16:50   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570DFD29.9090100@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).