git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git log --stat FILE
@ 2010-08-08 11:29 Marcus Comstedt
  2010-08-08 11:54 ` Jakub Narebski
  2010-08-08 11:54 ` Lars Hjemli
  0 siblings, 2 replies; 11+ messages in thread
From: Marcus Comstedt @ 2010-08-08 11:29 UTC (permalink / raw)
  To: git


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 11:29 git log --stat FILE Marcus Comstedt
@ 2010-08-08 11:54 ` Jakub Narebski
  2010-08-08 11:54 ` Lars Hjemli
  1 sibling, 0 replies; 11+ messages in thread
From: Jakub Narebski @ 2010-08-08 11:54 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: git

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 11:29 git log --stat FILE Marcus Comstedt
  2010-08-08 11:54 ` Jakub Narebski
@ 2010-08-08 11:54 ` Lars Hjemli
  2010-08-08 12:04   ` Marcus Comstedt
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Hjemli @ 2010-08-08 11:54 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: git

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 11:54 ` Lars Hjemli
@ 2010-08-08 12:04   ` Marcus Comstedt
  2010-08-08 12:26     ` Jakub Narebski
  0 siblings, 1 reply; 11+ messages in thread
From: Marcus Comstedt @ 2010-08-08 12:04 UTC (permalink / raw)
  To: Lars Hjemli, Jakub Narebski; +Cc: git


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 12:04   ` Marcus Comstedt
@ 2010-08-08 12:26     ` Jakub Narebski
  2010-08-08 12:35       ` Marcus Comstedt
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Narebski @ 2010-08-08 12:26 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: Lars Hjemli, git

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 12:26     ` Jakub Narebski
@ 2010-08-08 12:35       ` Marcus Comstedt
  2010-08-08 13:08         ` Jakub Narebski
  0 siblings, 1 reply; 11+ messages in thread
From: Marcus Comstedt @ 2010-08-08 12:35 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Lars Hjemli, git


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 12:35       ` Marcus Comstedt
@ 2010-08-08 13:08         ` Jakub Narebski
  2010-08-08 13:33           ` Marcus Comstedt
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Narebski @ 2010-08-08 13:08 UTC (permalink / raw)
  To: Marcus Comstedt; +Cc: Lars Hjemli, git

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git log --stat FILE
  2010-08-08 13:08         ` Jakub Narebski
@ 2010-08-08 13:33           ` Marcus Comstedt
  2010-08-08 15:31             ` [PATCH] Documentation/git-log: Clarify --full-diff Michael J Gruber
  0 siblings, 1 reply; 11+ messages in thread
From: Marcus Comstedt @ 2010-08-08 13:33 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Lars Hjemli, git


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] Documentation/git-log: Clarify --full-diff
  2010-08-08 13:33           ` Marcus Comstedt
@ 2010-08-08 15:31             ` Michael J Gruber
  2010-08-09  7:45               ` Matthieu Moy
  0 siblings, 1 reply; 11+ messages in thread
From: Michael J Gruber @ 2010-08-08 15:31 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jakub Narebski, Lars Hjemli, Marcus Comstedt

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] Documentation/git-log: Clarify --full-diff
  2010-08-08 15:31             ` [PATCH] Documentation/git-log: Clarify --full-diff Michael J Gruber
@ 2010-08-09  7:45               ` Matthieu Moy
  2010-08-09 19:57                 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Matthieu Moy @ 2010-08-09  7:45 UTC (permalink / raw)
  To: Michael J Gruber
  Cc: git, Junio C Hamano, Jakub Narebski, Lars Hjemli, Marcus Comstedt

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Documentation/git-log: Clarify --full-diff
  2010-08-09  7:45               ` Matthieu Moy
@ 2010-08-09 19:57                 ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2010-08-09 19:57 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: Michael J Gruber, git, Jakub Narebski, Lars Hjemli,
	Marcus Comstedt

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-08-09 19:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-08 11:29 git log --stat FILE Marcus Comstedt
2010-08-08 11:54 ` Jakub Narebski
2010-08-08 11:54 ` Lars Hjemli
2010-08-08 12:04   ` Marcus Comstedt
2010-08-08 12:26     ` Jakub Narebski
2010-08-08 12:35       ` Marcus Comstedt
2010-08-08 13:08         ` Jakub Narebski
2010-08-08 13:33           ` Marcus Comstedt
2010-08-08 15:31             ` [PATCH] Documentation/git-log: Clarify --full-diff Michael J Gruber
2010-08-09  7:45               ` Matthieu Moy
2010-08-09 19:57                 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).