# git log --stat FILE

11 messages from 2010-08-08 to 2010-08-09. Participants: Marcus Comstedt, Jakub Narebski, Lars Hjemli, Michael J Gruber, Matthieu Moy, Junio C Hamano.
Thread: https://gitlist.dev/t/24668

## Marcus Comstedt, 2010-08-08 11:29

Subject: git log --stat FILE
Message-ID: <yf9wrs1fili.fsf@chiyo.mc.pp.se>
URL: https://gitlist.dev/e/yf9wrs1fili.fsf%40chiyo.mc.pp.se

```

Hi guys.

I'm probably just missing something here, but I've run across a rather
annoying behavior of log.

When I do "git log --stat FILE", then only commits which touch FILE
are displayed, as expected.  However, contrary to expectation (well,
my expectation at least), the stat shows that only one file (FILE) is
modified by the commits, even if they actually modified multiple files.
That's not what I wanted; I used FILE to select commits, not to
control how they are presented.  In fact, the information which is
hidden is exactly that which I wanted to see; the whole reason for the
--stat was that I wanted to know what _other_ files were modified
together with FILE.

What's worse, I could not find how to circumvent this behavior, short
of using

 git log --format=format:'%H' FILE | xargs git show --stat

which isn't especially convenient...

So, if this behavior is intentional, how can it be turned off?


  // Marcus

```

## Jakub Narebski, 2010-08-08 11:54

Subject: Re: git log --stat FILE
Message-ID: <m339up48vz.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m339up48vz.fsf%40localhost.localdomain
In-Reply-To: <yf9wrs1fili.fsf@chiyo.mc.pp.se>

```
Marcus Comstedt <marcus@mc.pp.se> writes:

> Hi guys.
> 
> I'm probably just missing something here, but I've run across a rather
> annoying behavior of log.
> 
> When I do "git log --stat FILE", then only commits which touch FILE
> are displayed, as expected.  However, contrary to expectation (well,
> my expectation at least), the stat shows that only one file (FILE) is
> modified by the commits, even if they actually modified multiple files.
> That's not what I wanted; I used FILE to select commits, not to
> control how they are presented.  In fact, the information which is
> hidden is exactly that which I wanted to see; the whole reason for the
> --stat was that I wanted to know what _other_ files were modified
> together with FILE.
> 
> What's worse, I could not find how to circumvent this behavior, [...]

See --full-diff option to git-log.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Lars Hjemli, 2010-08-08 11:54

Subject: Re: git log --stat FILE
Message-ID: <AANLkTikKwp9gS9nt=JnsdyXMgx+PxrhHhNFftYFqX+M_@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikKwp9gS9nt%3DJnsdyXMgx%2BPxrhHhNFftYFqX%2BM_%40mail.gmail.com
In-Reply-To: <yf9wrs1fili.fsf@chiyo.mc.pp.se>

```
On Sun, Aug 8, 2010 at 13:29, Marcus Comstedt <marcus@mc.pp.se> wrote:
> When I do "git log --stat FILE", then only commits which touch FILE
> are displayed, as expected.  However, contrary to expectation (well,
> my expectation at least), the stat shows that only one file (FILE) is
> modified by the commits, even if they actually modified multiple files.
> That's not what I wanted;

Try adding --full-diff to your `git log` incantation.

--
larsh

```

## Marcus Comstedt, 2010-08-08 12:04

Subject: Re: git log --stat FILE
Message-ID: <yf9d3tts438.fsf@chiyo.mc.pp.se>
URL: https://gitlist.dev/e/yf9d3tts438.fsf%40chiyo.mc.pp.se
In-Reply-To: <AANLkTikKwp9gS9nt=JnsdyXMgx+PxrhHhNFftYFqX+M_@mail.gmail.com>

```

Thanks guys.

I suspected there was some option I had missed.  :-)

Both the option name and the documentaion mention only diffs, not
stats, which makes it a bit hard to find...


  // Marcus

```

## Jakub Narebski, 2010-08-08 12:26

Subject: Re: git log --stat FILE
Message-ID: <201008081426.21705.jnareb@gmail.com>
URL: https://gitlist.dev/e/201008081426.21705.jnareb%40gmail.com
In-Reply-To: <yf9d3tts438.fsf@chiyo.mc.pp.se>

```
On Sun, 8 Aug 2010, Marcus Comstedt wrote:
> 
> Thanks guys.
> 
> I suspected there was some option I had missed.  :-)
> 
> Both the option name and the documentaion mention only diffs, not
> stats, which makes it a bit hard to find...

Diffstat is just a diff format (a way of presenting diff); '--stat'
is described in "Common _diff_ options" of git-log(1) manpage.

But whats obvoud to me might not be obvious to everyone.
-- 
Jakub Narebski
Poland

```

## Marcus Comstedt, 2010-08-08 12:35

Subject: Re: git log --stat FILE
Message-ID: <yf9bp9ds2mz.fsf@chiyo.mc.pp.se>
URL: https://gitlist.dev/e/yf9bp9ds2mz.fsf%40chiyo.mc.pp.se
In-Reply-To: <201008081426.21705.jnareb@gmail.com>

```

Jakub Narebski <jnareb@gmail.com> writes:

> Diffstat is just a diff format (a way of presenting diff); '--stat'
> is described in "Common _diff_ options" of git-log(1) manpage.
>
> But whats obvoud to me might not be obvious to everyone.

To me (and probably many others), a "diff" is the output of the
command "/usr/bin/diff".  I notice that git seems to refer to this as
a "patch" instead.  Nevertheless, the documentation of --full-diff
explicitly talks about "log -p", rather than "diffs" in general.  So
it's not clear from the documentation that it affects other types of
diffs than those produced by -p ("patches").


  // Marcus

```

## Jakub Narebski, 2010-08-08 13:08

Subject: Re: git log --stat FILE
Message-ID: <201008081508.53732.jnareb@gmail.com>
URL: https://gitlist.dev/e/201008081508.53732.jnareb%40gmail.com
In-Reply-To: <yf9bp9ds2mz.fsf@chiyo.mc.pp.se>

```
Marcus Comstedt wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Diffstat is just a diff format (a way of presenting diff); '--stat'
> > is described in "Common _diff_ options" of git-log(1) manpage.
> >
> > But whats obvious to me might not be obvious to everyone.
> 
> To me (and probably many others), a "diff" is the output of the
> command "/usr/bin/diff".  I notice that git seems to refer to this as
> a "patch" instead.  Nevertheless, the documentation of --full-diff
> explicitly talks about "log -p", rather than "diffs" in general.  So
> it's not clear from the documentation that it affects other types of
> diffs than those produced by -p ("patches").

To me (and probably many others), a "diff" is something that describe
differences between two versions (compares two version).  Note that
'GNU diff' (and other "/usr/bin/diff") supports three output formats:
ed based, context and unified formats.  git-diff supports patch format
(unified, with some extensions), raw aka diff-tree format, and various
versions of diffstat format.

The '--full-diff' is a git-log option, not diff option, as it affects
how git-log uses path limiter.  "git log -p <path>..." is an example
of copmmand that shows diffs with commits, as "git log <path>..." alone
doesn't show diffs (in any format).  But perhaps the description of
'--full-diff' option could be improved.

The '--stat' is git-diff option, as you can see by running e.g.
"git diff --stat HEAD^!"

-- 
Jakub Narebski
Poland

```

## Marcus Comstedt, 2010-08-08 13:33

Subject: Re: git log --stat FILE
Message-ID: <yf9ocddut4h.fsf@chiyo.mc.pp.se>
URL: https://gitlist.dev/e/yf9ocddut4h.fsf%40chiyo.mc.pp.se
In-Reply-To: <201008081508.53732.jnareb@gmail.com>

```

Jakub Narebski <jnareb@gmail.com> writes:

> To me (and probably many others), a "diff" is something that describe
> differences between two versions (compares two version).

Jakub, there is no need for you to explain or justify why this is
obvious to you.  I have no problem accepting that at face value.
I'm simply trying to explain why this was not obvious to me, in the
hope of aiding any effort in improving the documentation.  After all,
writing documentation for something you feel is obvious is very
difficult.  But if you feel that the documentation is fine as it is,
that is also your privilege.


> Note that 'GNU diff' (and other "/usr/bin/diff") supports three
> output formats:  ed based, context and unified formats.

Indeed, and all those qualify as "diffs" in my mindset.  I would
however not consider the output of "diff -q" as a true "diff", and
naturally not the output of "diff --version".


  // Marcus

```

## Michael J Gruber, 2010-08-08 15:31

Subject: [PATCH] Documentation/git-log: Clarify --full-diff
Message-ID: <4acdfd58d0ff4aa6b55dab4d4233f55c1b753b5e.1281281303.git.git@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4acdfd58d0ff4aa6b55dab4d4233f55c1b753b5e.1281281303.git.git%40drmicha.warpmail.net
In-Reply-To: <yf9ocddut4h.fsf@chiyo.mc.pp.se>

```
The current description gives the impression that "--full-diff" affects
"log -p" only.

Make it clearer that it affects all diff-based output types.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/git-log.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index e970664..c213bdb 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -55,6 +55,9 @@ OPTIONS
 	paths.  With this, the full diff is shown for commits that touch
 	the specified paths; this means that "<path>..." limits only
 	commits, and doesn't limit diff for those commits.
++
+Note that this affects all diff-based output types, e.g. those
+produced by --stat etc.
 
 --log-size::
 	Before the log message print out its size in bytes. Intended
-- 
1.7.2.1.52.g7f7860

```

## Matthieu Moy, 2010-08-09 07:45

Subject: Re: [PATCH] Documentation/git-log: Clarify --full-diff
Message-ID: <vpqy6cgdybg.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqy6cgdybg.fsf%40bauges.imag.fr
In-Reply-To: <4acdfd58d0ff4aa6b55dab4d4233f55c1b753b5e.1281281303.git.git@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

> --- a/Documentation/git-log.txt
> +++ b/Documentation/git-log.txt
> @@ -55,6 +55,9 @@ OPTIONS
>  	paths.  With this, the full diff is shown for commits that touch
>  	the specified paths; this means that "<path>..." limits only
>  	commits, and doesn't limit diff for those commits.
> ++
> +Note that this affects all diff-based output types, e.g. those
> +produced by --stat etc.

+1.

This also help people grepping for "--stat" to find "--full-diff".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Junio C Hamano, 2010-08-09 19:57

Subject: Re: [PATCH] Documentation/git-log: Clarify --full-diff
Message-ID: <7vmxsv4kzk.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmxsv4kzk.fsf%40alter.siamese.dyndns.org
In-Reply-To: <vpqy6cgdybg.fsf@bauges.imag.fr>

```
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> --- a/Documentation/git-log.txt
>> +++ b/Documentation/git-log.txt
>> @@ -55,6 +55,9 @@ OPTIONS
>>  	paths.  With this, the full diff is shown for commits that touch
>>  	the specified paths; this means that "<path>..." limits only
>>  	commits, and doesn't limit diff for those commits.
>> ++
>> +Note that this affects all diff-based output types, e.g. those
>> +produced by --stat etc.
>
> +1.
>
> This also help people grepping for "--stat" to find "--full-diff".

Yeah, I think this is a good change especially to help new people that
come to git community every day.

Thanks.

```
