Re: [BUG] git diff-tree --stdin doesn't accept two trees

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [BUG] git diff-tree --stdin doesn't accept two trees

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:06

Karl Hasselström [off-list ref] writes:
I'm trying to use diff-tree --stdin to diff several trees in one go.
But I just get error messages when I feed it two space-separated trees
(one commit works fine):

  $ echo $(git rev-parse HEAD^{tree}) $(git rev-parse HEAD^^{tree}) | git diff-tree -p --stdin
  error: Object 7bfd9971f77438858e412be0219ec78afb3ca46f not a commit

This is at odds with the documentation:

  --stdin::
        When '--stdin' is specified, the command does not take
        <tree-ish> arguments from the command line.  Instead, it
        reads either one <commit> or a pair of <tree-ish>
        separated with a single space from its standard input.

I tried reading the code to figure out what's wrong, and as far as I
can tell the code to do this is there, but seems to be protected by
logic that aborts everything unless the whole input line is a valid
commit. Or maybe I'm just confused ...
No, the documentation was made wrong during 1.2.0 timeperiod.

The feature of --stdin to take a commit and its parents on one line was
broken before that to support the common

	rev-list --parents $commits... -- $paths... |
        diff-tree --stdin -v -p

usage pattern by Porcelains.  For diff-tree to talk sensibly about
commits, it needs to see commits, not just trees.


 

Re: [BUG] git diff-tree --stdin doesn't accept two trees

From: Karl Hasselström <hidden>
Date: 2016-06-15 22:45:07

On 2008-08-05 13:07:17 -0700, Junio C Hamano wrote:
Karl Hasselström [off-list ref] writes:
quoted
I'm trying to use diff-tree --stdin to diff several trees in one
go. But I just get error messages when I feed it two
space-separated trees (one commit works fine):
No, the documentation was made wrong during 1.2.0 timeperiod.

The feature of --stdin to take a commit and its parents on one line was
broken before that to support the common

        rev-list --parents $commits... -- $paths... |
                diff-tree --stdin -v -p

usage pattern by Porcelains.  For diff-tree to talk sensibly about
commits, it needs to see commits, not just trees.
But is there any fundamental reason why it couldn't accept tree-ishes
as well? It only talks about commits if asked to do so with
command-line options.

Or would that break existing users somehow?

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help