From: Linus Torvalds on

On Thu, 27 May 2010, Chris Mason wrote:
> # git diff v2.6.34 HEAD | diffstat

That still has the potential to be wrong (but got the numbers I expected
this time). It will be wrong in several cases:

- "diffstat" has some random common prefix removal logic that I've never
figured out the exact rules for.

You don't happen to see it, because you actually had changes outside of
fs/btrfs (so there was no common prefix to worry about), but if
everything had been inside fs/btrfs, then at least some versions of
diffstat will just remove that whole thing as common, and talk about
changes to 'ioctl.c' rather than 'fs/btrfs/ioctl.c'

(And no, I'm not entirely sure what triggers it. It might only happen
for certain patterns and/or certain versions of diffstat, but it's a
reason to avoid diffstat in general, or at least use "-p1" to make it

- it will do the wrong thing for renames and copies.

- it doesn't give the summary that pull-request does, which talks about
new, deleted and file-mode-changed files.

So just do

git diff --stat --summary -M v2.6.34..HEAD

instead, which gets all the above cases right. Also, you don't even need
to remember where you started - you might as well use git to do that too,
and write it as (assuming you have an 'origin' branch that points to the
upstream tree):

git diff --stat --summary -M origin...HEAD

(note the *three* dots: that says that you should diff against the common
ancestor, so git will just figure out where you started on its own).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at