threads / discuss / 46143

Clarifying behavior of diff --stat

Subject: Clarifying behavior of diff --stat

## tl;dr

2 messages between Jun 8, 2017 and Jun 9, 2017.

replies: 1people: 2as markdown or json

Samuel Lijin· Jun 8, 2017, 11:10 UTC · lore

I noticed when answering a StackOverflow question that apparently --stat modifies the raw diff itself, instead of just adding a diffstat to the output. In the linux kernel:

$ git diff-tree --raw -M 00a2430ff07d4e0e0e7e24e02fd8adede333b797 00a2430ff07d4e0e0e7e24e02fd8adede333b797 :040000 040000 f5792c6667c23e113a4f18acfdc5e2c38f5217d7 fb019210ebea7cf439f37d67111797ac7e37cca9 M drivers

$ git diff-tree --raw --stat -M 00a2430ff07d4e0e0e7e24e02fd8adede333b797
00a2430ff07d4e0e0e7e24e02fd8adede333b797
:100644 100644 c144102ea793541c7e8dad1d42072bb62e71ed4f
a186afeaa7001f3f81abb4f95d9edd3099477867 M
drivers/usb/gadget/Makefile
:000000 100644 0000000000000000000000000000000000000000
6d91f21b52a6301c303aac0a4f62e572d83c02aa A
drivers/usb/gadget/function/Makefile
:100644 100644 ab1065afbbd0c0cac55788dad3b805f9a240b2a9
ab1065afbbd0c0cac55788dad3b805f9a240b2a9 R100
drivers/usb/gadget/f_acm.c      drivers/usb/gadget/function/f_acm.c
:1006
[...]
 drivers/usb/gadget/Makefile                        | 30 +------------------
 drivers/usb/gadget/function/Makefile               | 34 ++++++++++++++++++++++
 drivers/usb/gadget/{ => function}/f_acm.c          |  0
 [...]

Is this intentional? And is there a way to generate a raw version of the extended stat without using --stat?

Jeff King· Jun 9, 2017, 05:21 UTC · re: Samuel Lijin · lore

Re: Clarifying behavior of diff --stat

On Thu, Jun 08, 2017 at 07:10:00AM -0400, Samuel Lijin wrote:
> I noticed when answering a StackOverflow question that apparently
> --stat modifies the raw diff itself, instead of just adding a diffstat
> to the output. In the linux kernel:

Sort of. Using "--stat" implies "-r", since it only deals with the actual blobs and would have nothing to show for tree entries.

And since recursive-ness is global to the whole diff, not just one output format, the --raw output becomes recursive, too.

> Is this intentional? And is there a way to generate a raw version of
> the extended stat without using --stat?
Try "git diff-tree --raw -r".
-Peff

← back to recent threads