{"thread":{"id":"14841","subject":"[BUG] git diff-tree --stdin doesn't accept two trees","startedAt":"2008-08-05T16:48:39Z","lastAt":"2008-08-06T15:31:13Z","messageCount":6,"participants":["Karl Hasselström","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"86278","messageId":"20080805164839.GA3934@diana.vm.bytemark.co.uk","threadId":"14841","inReplyTo":null,"subject":"[BUG] git diff-tree --stdin doesn't accept two trees","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-08-05T16:48:39Z","receivedAt":"2008-08-05T16:48:39Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"I'm trying to use diff-tree --stdin to diff several trees in one go.\nBut I just get error messages when I feed it two space-separated trees\n(one commit works fine):\n\n  $ echo $(git rev-parse HEAD^{tree}) $(git rev-parse HEAD^^{tree}) | git diff-tree -p --stdin\n  error: Object 7bfd9971f77438858e412be0219ec78afb3ca46f not a commit\n\nThis is at odds with the documentation:\n\n  --stdin::\n        When '--stdin' is specified, the command does not take\n        <tree-ish> arguments from the command line.  Instead, it\n        reads either one <commit> or a pair of <tree-ish>\n        separated with a single space from its standard input.\n\nI tried reading the code to figure out what's wrong, and as far as I\ncan tell the code to do this is there, but seems to be protected by\nlogic that aborts everything unless the whole input line is a valid\ncommit. Or maybe I'm just confused ...\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"86290","messageId":"7vwsivusy2.fsf@gitster.siamese.dyndns.org","threadId":"14841","inReplyTo":"20080805164839.GA3934@diana.vm.bytemark.co.uk","subject":"Re: [BUG] git diff-tree --stdin doesn't accept two trees","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-05T20:07:17Z","receivedAt":"2008-08-05T20:07:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> I'm trying to use diff-tree --stdin to diff several trees in one go.\n> But I just get error messages when I feed it two space-separated trees\n> (one commit works fine):\n>\n>   $ echo $(git rev-parse HEAD^{tree}) $(git rev-parse HEAD^^{tree}) | git diff-tree -p --stdin\n>   error: Object 7bfd9971f77438858e412be0219ec78afb3ca46f not a commit\n>\n> This is at odds with the documentation:\n>\n>   --stdin::\n>         When '--stdin' is specified, the command does not take\n>         <tree-ish> arguments from the command line.  Instead, it\n>         reads either one <commit> or a pair of <tree-ish>\n>         separated with a single space from its standard input.\n>\n> I tried reading the code to figure out what's wrong, and as far as I\n> can tell the code to do this is there, but seems to be protected by\n> logic that aborts everything unless the whole input line is a valid\n> commit. Or maybe I'm just confused ...\n\nNo, the documentation was made wrong during 1.2.0 timeperiod.\n\nThe feature of --stdin to take a commit and its parents on one line was\nbroken before that to support the common\n\n\trev-list --parents $commits... -- $paths... |\n        diff-tree --stdin -v -p\n\nusage pattern by Porcelains.  For diff-tree to talk sensibly about\ncommits, it needs to see commits, not just trees.\n\n\n \n"},{"id":"86316","messageId":"7v7iauu2s3.fsf_-_@gitster.siamese.dyndns.org","threadId":"14841","inReplyTo":"7vwsivusy2.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] fix diff-tree --stdin documentation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-06T05:32:28Z","receivedAt":"2008-08-06T05:32:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Long time ago, the feature of \"diff-tree --stdin\" to take a commit and its\nparents on one line was broken, and did not support the common:\n\n    git rev-list --parents $commits... -- $paths... |\n    git diff-tree --stdin -v -p\n\nusage pattern by Porcelains properly.  For diff-tree to talk sensibly\nabout commits, it needs to see commits, not just trees; the code was fixed\nto take list of commits on the standard input in 1.2.0.\n\nHowever we left the documentation stale for a long time, until Karl\nHasselström finally noticed it very recently.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\ndiff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt\nindex 8c8f35b..1fdf20d 100644\n--- a/Documentation/git-diff-tree.txt\n+++ b/Documentation/git-diff-tree.txt\n@@ -49,13 +49,13 @@ include::diff-options.txt[]\n --stdin::\n \tWhen '--stdin' is specified, the command does not take\n \t<tree-ish> arguments from the command line.  Instead, it\n-\treads either one <commit> or a pair of <tree-ish>\n+\treads either one <commit> or a list of <commit>\n \tseparated with a single space from its standard input.\n +\n When a single commit is given on one line of such input, it compares\n the commit with its parents.  The following flags further affects its\n-behavior.  This does not apply to the case where two <tree-ish>\n-separated with a single space are given.\n+behavior.  The remaining commits, when given, are used as if they are\n+parents of the first commit.\n \n -m::\n \tBy default, 'git-diff-tree --stdin' does not show\n"},{"id":"86329","messageId":"20080806100450.GB18336@diana.vm.bytemark.co.uk","threadId":"14841","inReplyTo":"7v7iauu2s3.fsf_-_@gitster.siamese.dyndns.org","subject":"Re: [PATCH] fix diff-tree --stdin documentation","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-08-06T10:04:50Z","receivedAt":"2008-08-06T10:04:50Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-08-05 22:32:28 -0700, Junio C Hamano wrote:\n\n> -\treads either one <commit> or a pair of <tree-ish>\n> +\treads either one <commit> or a list of <commit>\n\nThanks. Didn't quite solve my problem though, since diffing trees was\nwhat I wanted to use diff-tree for. :-/ But I think I can rephrase my\nproblem so that I give it a commit instead.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"86338","messageId":"20080806115358.GD18336@diana.vm.bytemark.co.uk","threadId":"14841","inReplyTo":"7vwsivusy2.fsf@gitster.siamese.dyndns.org","subject":"Re: [BUG] git diff-tree --stdin doesn't accept two trees","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-08-06T11:53:58Z","receivedAt":"2008-08-06T11:53:58Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-08-05 13:07:17 -0700, Junio C Hamano wrote:\n\n> Karl Hasselström <kha@treskal.com> writes:\n>\n> > I'm trying to use diff-tree --stdin to diff several trees in one\n> > go. But I just get error messages when I feed it two\n> > space-separated trees (one commit works fine):\n>\n> No, the documentation was made wrong during 1.2.0 timeperiod.\n>\n> The feature of --stdin to take a commit and its parents on one line was\n> broken before that to support the common\n>\n>         rev-list --parents $commits... -- $paths... |\n>                 diff-tree --stdin -v -p\n>\n> usage pattern by Porcelains.  For diff-tree to talk sensibly about\n> commits, it needs to see commits, not just trees.\n\nBut is there any fundamental reason why it couldn't accept tree-ishes\nas well? It only talks about commits if asked to do so with\ncommand-line options.\n\nOr would that break existing users somehow?\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"86354","messageId":"7vbq06rwhq.fsf@gitster.siamese.dyndns.org","threadId":"14841","inReplyTo":"20080806115358.GD18336@diana.vm.bytemark.co.uk","subject":"Re: [BUG] git diff-tree --stdin doesn't accept two trees","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-06T15:31:13Z","receivedAt":"2008-08-06T15:31:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n>> The feature of --stdin to take a commit and its parents on one line was\n>> broken before that to support the common\n>>\n>>         rev-list --parents $commits... -- $paths... |\n>>                 diff-tree --stdin -v -p\n>>\n>> usage pattern by Porcelains.  For diff-tree to talk sensibly about\n>> commits, it needs to see commits, not just trees.\n>\n> But is there any fundamental reason why it couldn't accept tree-ishes\n> as well?\n\nThe -v option given to diff-tree is the key.  Without it, it could take\ntrees.\n"}]}