{"thread":{"id":"42004","subject":"[RFD/BUG?] git show with tree/commit","startedAt":"2016-04-12T15:33:33Z","lastAt":"2016-04-13T09:41:00Z","messageCount":6,"participants":["Michael J Gruber","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"283191","messageId":"570D154D.6090006@drmicha.warpmail.net","threadId":"42004","inReplyTo":null,"subject":"[RFD/BUG?] git show with tree/commit","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2016-04-12T15:33:33Z","receivedAt":"2016-04-12T15:33:33Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"With current next, using any commit sha1:\n\n$ git cat-file -p cab2cdadfda8e8e8631026443b11d3ed6e7ba517\ntree 04050d37b1676ba8da277be1902513049b45413a\nparent b673b5e7d121021f77768c736cd9f98d7b3b3967\nparent 7b0d47b3b6b5b64e02a5aa06b0452cadcdb18355\n...\n\n$ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\ntree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n\n.gitattributes\n.gitignore\n.mailmap\n...\n\n$ git show 04050d37b1676ba8da277be1902513049b45413a:\ntree 04050d37b1676ba8da277be1902513049b45413a\n\n.gitattributes\n.gitignore\n.mailmap\n...\n\nWhile it's clear to me what's going on, I'm wondering whether it's a\ngood idea that \"git show\" says \"tree\" in front of the unresolved\ntreeish, whether it's a tree, a commit or something else. I think it's\npretty confusing. Alternatives would be:\n\ntree <resolved tree id> # here: 040...\ntreeish <treeish>\t# here: \"treeish cab2c...\"\ntree <treeish>^{tree} \t# here: \"tree cab2c^{tree}\"\n\nCheers\nMichael\n"},{"id":"283199","messageId":"xmqq4mb6sshz.fsf@gitster.mtv.corp.google.com","threadId":"42004","inReplyTo":"570D154D.6090006@drmicha.warpmail.net","subject":"Re: [RFD/BUG?] git show with tree/commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-12T16:26:32Z","receivedAt":"2016-04-12T16:26:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>\n> .gitattributes\n> .gitignore\n> .mailmap\n> ...\n>\n> While it's clear to me what's going on, I'm wondering whether it's a\n> good idea that \"git show\" says \"tree\" in front of the unresolved\n> treeish, whether it's a tree, a commit or something else. I think it's\n> pretty confusing.\n\nThere is no \"unresolved treeish\" on the line that begins with\n\"tree\", but I suspect it wasn't very clear to you because of the way\nyou gave the command its input; notice the line in question ends\nwith a colon, which is unfortunate, but it turns out that it is your\nfault ;-).  Read on.\n\n> Alternatives would be:\n>\n> tree <resolved tree id> # here: 040...\n> treeish <treeish>\t# here: \"treeish cab2c...\"\n> tree <treeish>^{tree} \t# here: \"tree cab2c^{tree}\"\n\nSo, the three choices are\n\n (1) resolve the tree object name to 40-hex and show it as\n     \"tree <object name in hex>\"\n\n (2) given an object that is not a tree, show it as \"treeish <object\n     name>\" \n\n (3) do not do anything fancy, just show it as \"tree <object name>\"\n     using what the user gave us.\n\nI think the current output is doing the third one (notice the colon\nat the end of the line).\n\n    $ git show master: | head -n 1\n    $ git show master^{tree} | head -n 1\n    $ git show cab2cdadf: | head -n 1\n"},{"id":"283201","messageId":"20160412163420.GA23462@sigill.intra.peff.net","threadId":"42004","inReplyTo":"570D154D.6090006@drmicha.warpmail.net","subject":"Re: [RFD/BUG?] git show with tree/commit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-04-12T16:34:21Z","receivedAt":"2016-04-12T16:34:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 12, 2016 at 05:33:33PM +0200, Michael J Gruber wrote:\n\n> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n> \n> .gitattributes\n> .gitignore\n> .mailmap\n> ...\n\nAs Junio pointed out, the colon here is not syntactic, but from the\noriginal object name you gave it. But here...\n\n> $ git show 04050d37b1676ba8da277be1902513049b45413a:\n> tree 04050d37b1676ba8da277be1902513049b45413a\n> \n> .gitattributes\n> .gitignore\n> .mailmap\n> ...\n\n...it is missing. Did you mean to omit it from the command-line?\n\n-Peff\n"},{"id":"283202","messageId":"xmqqzisyrcsu.fsf@gitster.mtv.corp.google.com","threadId":"42004","inReplyTo":"20160412163420.GA23462@sigill.intra.peff.net","subject":"Re: [RFD/BUG?] git show with tree/commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-12T16:50:57Z","receivedAt":"2016-04-12T16:50:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Apr 12, 2016 at 05:33:33PM +0200, Michael J Gruber wrote:\n>\n>> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>> \n>> .gitattributes\n>> .gitignore\n>> .mailmap\n>> ...\n>\n> As Junio pointed out, the colon here is not syntactic, but from the\n> original object name you gave it. But here...\n>\n>> $ git show 04050d37b1676ba8da277be1902513049b45413a:\n>> tree 04050d37b1676ba8da277be1902513049b45413a\n>> \n>> .gitattributes\n>> .gitignore\n>> .mailmap\n>> ...\n>\n> ...it is missing. Did you mean to omit it from the command-line?\n\nI suspect that is cut-and-paste something.  I see:\n\n    $ git show 04050d37b1676ba8da277be1902513049b45413a: | head -n1\n    tree 04050d37b1676ba8da277be1902513049b45413a:\n    $ git show 04050d37b1676ba8da277be1902513049b45413a | head -n1\n    tree 04050d37b1676ba8da277be1902513049b45413a\n\nwhich is expected.\n\nIt indeed becomes confusing when you give \"<treeish>:\" from the\ncommand line, as it looks as if there is conceptually a list of tree\ncontents that is shown like so:\n\n    tree tree1:\n    contents of tree1\n\n    tree tree2:\n    contents of tree2\n    ...\n\nand we are showing only the first one.  If the original input were\ngiven as \"<treeish>^{tree}\", there is no confusion.\n"},{"id":"283302","messageId":"570DFD29.9090100@drmicha.warpmail.net","threadId":"42004","inReplyTo":"xmqq4mb6sshz.fsf@gitster.mtv.corp.google.com","subject":"Re: [RFD/BUG?] git show with tree/commit","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2016-04-13T08:02:49Z","receivedAt":"2016-04-13T08:02:49Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 12.04.2016 18:26:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>>\n>> .gitattributes\n>> .gitignore\n>> .mailmap\n>> ...\n>>\n>> While it's clear to me what's going on, I'm wondering whether it's a\n>> good idea that \"git show\" says \"tree\" in front of the unresolved\n>> treeish, whether it's a tree, a commit or something else. I think it's\n>> pretty confusing.\n> \n> There is no \"unresolved treeish\" on the line that begins with\n> \"tree\", but I suspect it wasn't very clear to you because of the way\n> you gave the command its input; notice the line in question ends\n> with a colon, which is unfortunate, but it turns out that it is your\n> fault ;-).  Read on.\n\nGuess what, I know the difference between \"git show <commit>\" and git\nshow <commit>:\"...\n\n>> Alternatives would be:\n>>\n>> tree <resolved tree id> # here: 040...\n>> treeish <treeish>\t# here: \"treeish cab2c...\"\n>> tree <treeish>^{tree} \t# here: \"tree cab2c^{tree}\"\n> \n> So, the three choices are\n> \n>  (1) resolve the tree object name to 40-hex and show it as\n>      \"tree <object name in hex>\"\n> \n>  (2) given an object that is not a tree, show it as \"treeish <object\n>      name>\" \n> \n>  (3) do not do anything fancy, just show it as \"tree <object name>\"\n>      using what the user gave us.\n\n(3) ist not quite what I'm after, but I guess when \"git show\" receives\n\"<commit>:\" there is no way it could trace back that tree reference to\nthe commit. In fact, (3) is what we have now.\n\n> I think the current output is doing the third one (notice the colon\n> at the end of the line).\n> \n>     $ git show master: | head -n 1\n>     $ git show master^{tree} | head -n 1\n>     $ git show cab2cdadf: | head -n 1\n> \n\nI confess that I failed to copy the trailing \":\" from the original\noutput... So that one is my fault.\n\nIn fact, while specifying \"<commit>:\" knowingly to show the tree, I\ninterpreted the \":\" in the output as a simple colon introducing the\nfollowing output, at least at first glance.\n\nI guess (1) would be the only option that would help (because\n\"<commit>:\" is a tree, not a non-tree treeish).\n\nMichael\n"},{"id":"283307","messageId":"570E142C.8050200@drmicha.warpmail.net","threadId":"42004","inReplyTo":"570DFD29.9090100@drmicha.warpmail.net","subject":"Re: [RFD/BUG?] git show with tree/commit","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2016-04-13T09:41:00Z","receivedAt":"2016-04-13T09:41:00Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Michael J Gruber venit, vidit, dixit 13.04.2016 10:02:\n> Junio C Hamano venit, vidit, dixit 12.04.2016 18:26:\n>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>>\n>>> $ git show cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>>> tree cab2cdadfda8e8e8631026443b11d3ed6e7ba517:\n>>>\n>>> .gitattributes\n>>> .gitignore\n>>> .mailmap\n>>> ...\n>>>\n>>> While it's clear to me what's going on, I'm wondering whether it's a\n>>> good idea that \"git show\" says \"tree\" in front of the unresolved\n>>> treeish, whether it's a tree, a commit or something else. I think it's\n>>> pretty confusing.\n>>\n>> There is no \"unresolved treeish\" on the line that begins with\n>> \"tree\", but I suspect it wasn't very clear to you because of the way\n>> you gave the command its input; notice the line in question ends\n>> with a colon, which is unfortunate, but it turns out that it is your\n>> fault ;-).  Read on.\n> \n> Guess what, I know the difference between \"git show <commit>\" and git\n> show <commit>:\"...\n> \n>>> Alternatives would be:\n>>>\n>>> tree <resolved tree id> # here: 040...\n>>> treeish <treeish>\t# here: \"treeish cab2c...\"\n>>> tree <treeish>^{tree} \t# here: \"tree cab2c^{tree}\"\n>>\n>> So, the three choices are\n>>\n>>  (1) resolve the tree object name to 40-hex and show it as\n>>      \"tree <object name in hex>\"\n>>\n>>  (2) given an object that is not a tree, show it as \"treeish <object\n>>      name>\" \n>>\n>>  (3) do not do anything fancy, just show it as \"tree <object name>\"\n>>      using what the user gave us.\n> \n> (3) ist not quite what I'm after, but I guess when \"git show\" receives\n> \"<commit>:\" there is no way it could trace back that tree reference to\n> the commit. In fact, (3) is what we have now.\n> \n>> I think the current output is doing the third one (notice the colon\n>> at the end of the line).\n>>\n>>     $ git show master: | head -n 1\n>>     $ git show master^{tree} | head -n 1\n>>     $ git show cab2cdadf: | head -n 1\n>>\n> \n> I confess that I failed to copy the trailing \":\" from the original\n> output... So that one is my fault.\n> \n> In fact, while specifying \"<commit>:\" knowingly to show the tree, I\n> interpreted the \":\" in the output as a simple colon introducing the\n> following output, at least at first glance.\n> \n> I guess (1) would be the only option that would help (because\n> \"<commit>:\" is a tree, not a non-tree treeish).\n> \n> Michael\n\n... adding to that, \"git show foo\" shows\n\n\"commit <sha1 of foo>\" for a commit object\n\"tree <verbatim foo>\" for a tree object\n\nnothing like that for tag objects and blobs (just the object contents)\n\nSo for 2 out of the 4 object types, it shows a \"header line\", and both\nof them show the specified argument differently (resolved to sha1 resp.\nverbatim). It's that inconsistency that I find confusing.\n\nMichael\n"}]}