# confusion with git diff-tree output

7 messages from 2009-10-21 to 2009-10-24. Participants: David Roundy, Jan Krüger, Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/21312

## David Roundy, 2009-10-21 17:43

Subject: confusion with git diff-tree output
Message-ID: <117f2cc80910211043q3a92a7b6o15464cc049ee33dc@mail.gmail.com>
URL: https://gitlist.dev/e/117f2cc80910211043q3a92a7b6o15464cc049ee33dc%40mail.gmail.com

```
Hi all,

I've been struggling with trying to figure out how to make diff-tree
output the actual files changed.  Below is the output when I run
diff-tree on a given commit.  It reports that the directory is
modified, rather than that a single file within that directory is
modified.  I can find out what *file* was modified by running
diff-tree -p --raw, which gives me output similar to what I expected
from a plain old diff-tree.  Is there a flag that will make diff-tree
give this information?

As background, what I really want is --name-only, which rarely reports
the files modified, instead reporting the directories as modified, and
I've been struggling to figure out what is going on.  The
documentation seems to imply that the --raw diff output will report
modified files, and I haven't found anything indicating when it would
report the directories containing the modified files instead.

Thanks!
David

$ git diff-tree fd99a198222c14cf42fee82087a13467ff4a8205
fd99a198222c14cf42fee82087a13467ff4a8205
:040000 040000 8cdb796ea801da99c34d8f60045d8eb08fbb0e41
66b67ea1763799c0b2ac01f6803177ca870f6544 M	Iolaus

$ git diff-tree fd99a198222c14cf42fee82087a13467ff4a8205 -p --raw
fd99a198222c14cf42fee82087a13467ff4a8205
:100644 100644 dab4c531f3f69f08e5dc202ad8b6dfad9e8855fe
0e3f305e641a6440bb478765dfcd089e0420c155 M	Iolaus/Lcs2.hs

diff --git a/Iolaus/Lcs2.hs b/Iolaus/Lcs2.hs
index dab4c53..0e3f305 100644
--- a/Iolaus/Lcs2.hs
+++ b/Iolaus/Lcs2.hs
(changes cut)

```

## Jan Krüger, 2009-10-21 17:51

Subject: Re: confusion with git diff-tree output
Message-ID: <20091021195103.01cef9c4@perceptron>
URL: https://gitlist.dev/e/20091021195103.01cef9c4%40perceptron
In-Reply-To: <117f2cc80910211043q3a92a7b6o15464cc049ee33dc@mail.gmail.com>

```
> David Roundy <roundyd@physics.oregonstate.edu> wrote:

> I've been struggling with trying to figure out how to make diff-tree
> output the actual files changed.  Below is the output when I run
> diff-tree on a given commit.  It reports that the directory is
> modified, rather than that a single file within that directory is
> modified.

Tree objects are recursively nested, i.e.

> 66b67ea1763799c0b2ac01f6803177ca870f6544 M	Iolaus

is a reference to another tree object... and since a file in that
subtree changed, a new tree object that contains a different file
record is now referenced as "Iolaus".

By default git diff-tree doesn't recurse, but you can use -r for that.
Which is documented, I might add. ;)

Jan

```

## David Roundy, 2009-10-21 22:23

Subject: Re: confusion with git diff-tree output
Message-ID: <117f2cc80910211523m5c1399aej594398fb6597e5de@mail.gmail.com>
URL: https://gitlist.dev/e/117f2cc80910211523m5c1399aej594398fb6597e5de%40mail.gmail.com
In-Reply-To: <20091021195103.01cef9c4@perceptron>

```
You're right.  I figured I must be overlooking something obvious, and
that was it.  What surprised me was that -p implies -r, which is not
documented.  Since the -p output was recursive, I incorrectly presumed
that this was the default.

David

On Wed, Oct 21, 2009 at 1:51 PM, Jan Krüger <jk@jk.gs> wrote:
> Tree objects are recursively nested, i.e.
>
>> 66b67ea1763799c0b2ac01f6803177ca870f6544 M    Iolaus
>
> is a reference to another tree object... and since a file in that
> subtree changed, a new tree object that contains a different file
> record is now referenced as "Iolaus".
>
> By default git diff-tree doesn't recurse, but you can use -r for that.
> Which is documented, I might add. ;)

```

## Jan Krüger, 2009-10-21 22:42

Subject: Re: confusion with git diff-tree output
Message-ID: <20091022004220.7e579547@perceptron>
URL: https://gitlist.dev/e/20091022004220.7e579547%40perceptron
In-Reply-To: <117f2cc80910211523m5c1399aej594398fb6597e5de@mail.gmail.com>

```
> David Roundy <roundyd@physics.oregonstate.edu> wrote:

> You're right.  I figured I must be overlooking something obvious, and
> that was it.  What surprised me was that -p implies -r, which is not
> documented.  Since the -p output was recursive, I incorrectly presumed
> that this was the default.

I suppose that's because you can't really display the diff for a
directory in any meaningful way other than recursing.

Jan

```

## Jeff King, 2009-10-23 00:54

Subject: Re: confusion with git diff-tree output
Message-ID: <20091023005426.GA2431@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20091023005426.GA2431%40sigill.intra.peff.net
In-Reply-To: <117f2cc80910211523m5c1399aej594398fb6597e5de@mail.gmail.com>

```
On Wed, Oct 21, 2009 at 06:23:08PM -0400, David Roundy wrote:

> You're right.  I figured I must be overlooking something obvious, and
> that was it.  What surprised me was that -p implies -r, which is not
> documented.  Since the -p output was recursive, I incorrectly presumed
> that this was the default.

It's due to hysterical raisins:

  http://article.gmane.org/gmane.comp.version-control.git/54078

-Peff

```

## Junio C Hamano, 2009-10-24 06:36

Subject: Re: confusion with git diff-tree output
Message-ID: <7vvdi58fhw.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vvdi58fhw.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20091023005426.GA2431@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Wed, Oct 21, 2009 at 06:23:08PM -0400, David Roundy wrote:
>
>> You're right.  I figured I must be overlooking something obvious, and
>> that was it.  What surprised me was that -p implies -r, which is not
>> documented.  Since the -p output was recursive, I incorrectly presumed
>> that this was the default.
>
> It's due to hysterical raisins:
>
>   http://article.gmane.org/gmane.comp.version-control.git/54078

Just to make sure, the Porcelain "diff" does recurse even with --raw 
and "diff-tree" doesn't for historical reasons, right?

```

## Jeff King, 2009-10-24 09:51

Subject: Re: confusion with git diff-tree output
Message-ID: <20091024095156.GA9865@sigio.peff.net>
URL: https://gitlist.dev/e/20091024095156.GA9865%40sigio.peff.net
In-Reply-To: <7vvdi58fhw.fsf@alter.siamese.dyndns.org>

```
On Fri, Oct 23, 2009 at 11:36:59PM -0700, Junio C Hamano wrote:

> >> You're right.  I figured I must be overlooking something obvious, and
> >> that was it.  What surprised me was that -p implies -r, which is not
> >> documented.  Since the -p output was recursive, I incorrectly presumed
> >> that this was the default.
> >
> > It's due to hysterical raisins:
> >
> >   http://article.gmane.org/gmane.comp.version-control.git/54078
> 
> Just to make sure, the Porcelain "diff" does recurse even with --raw 
> and "diff-tree" doesn't for historical reasons, right?

Yes, that's right (and yes, I just checked it to be double sure).

-Peff

```
