* [RFD/BUG?] git show with tree/commit @ 2016-04-12 15:33 Michael J Gruber 2016-04-12 16:26 ` Junio C Hamano 2016-04-12 16:34 ` Jeff King 0 siblings, 2 replies; 6+ messages in thread From: Michael J Gruber @ 2016-04-12 15:33 UTC (permalink / raw) To: Git Mailing List With current next, using any commit sha1: $ git cat-file -p cab2cdadfda8e8e8631026443b11d3ed6e7ba517 tree 04050d37b1676ba8da277be1902513049b45413a parent b673b5e7d121021f77768c736cd9f98d7b3b3967 parent 7b0d47b3b6b5b64e02a5aa06b0452cadcdb18355 ... $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517: tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517: .gitattributes .gitignore .mailmap ... $ git show 04050d37b1676ba8da277be1902513049b45413a: tree 04050d37b1676ba8da277be1902513049b45413a .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. Alternatives would be: tree <resolved tree id> # here: 040... treeish <treeish> # here: "treeish cab2c..." tree <treeish>^{tree} # here: "tree cab2c^{tree}" Cheers Michael ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFD/BUG?] git show with tree/commit 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 2016-04-12 16:34 ` Jeff King 1 sibling, 1 reply; 6+ messages in thread From: Junio C Hamano @ 2016-04-12 16:26 UTC (permalink / raw) To: Michael J Gruber; +Cc: Git Mailing List 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. > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFD/BUG?] git show with tree/commit 2016-04-12 16:26 ` Junio C Hamano @ 2016-04-13 8:02 ` Michael J Gruber 2016-04-13 9:41 ` Michael J Gruber 0 siblings, 1 reply; 6+ messages in thread From: Michael J Gruber @ 2016-04-13 8:02 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git Mailing List, Jeff King 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFD/BUG?] git show with tree/commit 2016-04-13 8:02 ` Michael J Gruber @ 2016-04-13 9:41 ` Michael J Gruber 0 siblings, 0 replies; 6+ messages in thread From: Michael J Gruber @ 2016-04-13 9:41 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git Mailing List, Jeff King Michael J Gruber venit, vidit, dixit 13.04.2016 10:02: > 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 ... adding to that, "git show foo" shows "commit <sha1 of foo>" for a commit object "tree <verbatim foo>" for a tree object nothing like that for tag objects and blobs (just the object contents) So for 2 out of the 4 object types, it shows a "header line", and both of them show the specified argument differently (resolved to sha1 resp. verbatim). It's that inconsistency that I find confusing. Michael ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFD/BUG?] git show with tree/commit 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-12 16:34 ` Jeff King 2016-04-12 16:50 ` Junio C Hamano 1 sibling, 1 reply; 6+ messages in thread From: Jeff King @ 2016-04-12 16:34 UTC (permalink / raw) To: Michael J Gruber; +Cc: Git Mailing List On Tue, Apr 12, 2016 at 05:33:33PM +0200, Michael J Gruber wrote: > $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517: > tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517: > > .gitattributes > .gitignore > .mailmap > ... As Junio pointed out, the colon here is not syntactic, but from the original object name you gave it. But here... > $ git show 04050d37b1676ba8da277be1902513049b45413a: > tree 04050d37b1676ba8da277be1902513049b45413a > > .gitattributes > .gitignore > .mailmap > ... ...it is missing. Did you mean to omit it from the command-line? -Peff ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFD/BUG?] git show with tree/commit 2016-04-12 16:34 ` Jeff King @ 2016-04-12 16:50 ` Junio C Hamano 0 siblings, 0 replies; 6+ messages in thread From: Junio C Hamano @ 2016-04-12 16:50 UTC (permalink / raw) To: Jeff King; +Cc: Michael J Gruber, Git Mailing List Jeff King <peff@peff.net> writes: > On Tue, Apr 12, 2016 at 05:33:33PM +0200, Michael J Gruber wrote: > >> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517: >> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517: >> >> .gitattributes >> .gitignore >> .mailmap >> ... > > As Junio pointed out, the colon here is not syntactic, but from the > original object name you gave it. But here... > >> $ git show 04050d37b1676ba8da277be1902513049b45413a: >> tree 04050d37b1676ba8da277be1902513049b45413a >> >> .gitattributes >> .gitignore >> .mailmap >> ... > > ...it is missing. Did you mean to omit it from the command-line? I suspect that is cut-and-paste something. I see: $ git show 04050d37b1676ba8da277be1902513049b45413a: | head -n1 tree 04050d37b1676ba8da277be1902513049b45413a: $ git show 04050d37b1676ba8da277be1902513049b45413a | head -n1 tree 04050d37b1676ba8da277be1902513049b45413a which is expected. It indeed becomes confusing when you give "<treeish>:" from the command line, as it looks as if there is conceptually a list of tree contents that is shown like so: tree tree1: contents of tree1 tree tree2: contents of tree2 ... and we are showing only the first one. If the original input were given as "<treeish>^{tree}", there is no confusion. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-13 9:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2016-04-13 9:41 ` Michael J Gruber 2016-04-12 16:34 ` Jeff King 2016-04-12 16:50 ` Junio C Hamano
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).