All of lore.kernel.org
 help / color / mirror / Atom feed
* diffstat witdth with one changed file
@ 2012-05-21 15:52 Nguyen Thai Ngoc Duy
  2012-05-21 17:33 ` Andreas Schwab
  2012-05-22  5:59 ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 2 replies; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-21 15:52 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Zbigniew Jędrzejewski-Szmek

Hi,

With recent git, "git log --stat 90e6ef5", the first commit's diffstat
uses full terminal width while the next one uses less than 80 chars.
Both changes one file. Is it intentional? I tend to think it's a bug
because with one-file changes, diffstat width is not important as we
have no other files to compare with.
-- 
Duy

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

* Re: diffstat witdth with one changed file
  2012-05-21 15:52 diffstat witdth with one changed file Nguyen Thai Ngoc Duy
@ 2012-05-21 17:33 ` Andreas Schwab
  2012-05-21 22:20   ` Junio C Hamano
  2012-05-22  5:59 ` Zbigniew Jędrzejewski-Szmek
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2012-05-21 17:33 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List, Zbigniew Jędrzejewski-Szmek

Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:

> With recent git, "git log --stat 90e6ef5", the first commit's diffstat
> uses full terminal width while the next one uses less than 80 chars.
> Both changes one file. Is it intentional?

In commit 0e641b1 the file has only 41 lines of changes, so it looks
intentional.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: diffstat witdth with one changed file
  2012-05-21 17:33 ` Andreas Schwab
@ 2012-05-21 22:20   ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-05-21 22:20 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Nguyen Thai Ngoc Duy, Git Mailing List, Zbigniew Jędrzejewski-Szmek

Andreas Schwab <schwab@linux-m68k.org> writes:

> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
>> With recent git, "git log --stat 90e6ef5", the first commit's diffstat
>> uses full terminal width while the next one uses less than 80 chars.
>> Both changes one file. Is it intentional?
>
> In commit 0e641b1 the file has only 41 lines of changes, so it looks
> intentional.

Correct.  We do not try to make width of bars from two different commits
comparable [*1*], but we do try to make them comparable within a single
commit; for a commit that changes only a single path, you still have adds
and removals to compare.  The overall length is ideally one + or - per
line if the graph fits the output width, but if that makes the graph too
wide, we scale to fit in the output width.  So a change with 41 lines gets
only 41 +/- and does not consume full 80-column terminal.

[Footnote]

*1* This is very much on purpose; otherwise it will hurt the perceived
latency of the command.

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

* Re: diffstat witdth with one changed file
  2012-05-21 15:52 diffstat witdth with one changed file Nguyen Thai Ngoc Duy
  2012-05-21 17:33 ` Andreas Schwab
@ 2012-05-22  5:59 ` Zbigniew Jędrzejewski-Szmek
  2012-05-22 12:50   ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 6+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-05-22  5:59 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List

On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:
> Hi,
> 
> With recent git, "git log --stat 90e6ef5", the first commit's diffstat
> uses full terminal width while the next one uses less than 80 chars.
> Both changes one file. Is it intentional? I tend to think it's a bug
> because with one-file changes, diffstat width is not important as we
> have no other files to compare with.
Hi,
90e6ef5 makes 502 additions/deletions, so it scales the +- part to the
whole available terminal width. 90e6ef5^ does only 41 additions, so it
can display the +- part unscaled without even filling the terminal width.

Since we don't coordinate the diffstat width between different commits
in the same git-log invocation, there's no way to make the diffstats use
the same scale. Anyway, diffstat is only supposed to give a rough
overview, and it does that here.

What output would you expect?

Zbyszek

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

* Re: diffstat witdth with one changed file
  2012-05-22  5:59 ` Zbigniew Jędrzejewski-Szmek
@ 2012-05-22 12:50   ` Nguyen Thai Ngoc Duy
  2012-05-22 16:47     ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 6+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-22 12:50 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: Git Mailing List

On Tue, May 22, 2012 at 12:59 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl> wrote:
> On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:
>> Hi,
>>
>> With recent git, "git log --stat 90e6ef5", the first commit's diffstat
>> uses full terminal width while the next one uses less than 80 chars.
>> Both changes one file. Is it intentional? I tend to think it's a bug
>> because with one-file changes, diffstat width is not important as we
>> have no other files to compare with.
> Hi,
> 90e6ef5 makes 502 additions/deletions, so it scales the +- part to the
> whole available terminal width. 90e6ef5^ does only 41 additions, so it
> can display the +- part unscaled without even filling the terminal width.
>
> Since we don't coordinate the diffstat width between different commits
> in the same git-log invocation, there's no way to make the diffstats use
> the same scale. Anyway, diffstat is only supposed to give a rough
> overview, and it does that here.

Yeah, others have explained it. And it makes sense.

> What output would you expect?

It just looks weird that while most of the commits fill half of my
screen (200 char width), some diffstats strike a line through the
right edge. And I did not see the reason for that in the beginning
because I thought long lines only makes sense when compare to other
lines.
-- 
Duy

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

* Re: diffstat witdth with one changed file
  2012-05-22 12:50   ` Nguyen Thai Ngoc Duy
@ 2012-05-22 16:47     ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 6+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-05-22 16:47 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List

On 05/22/2012 02:50 PM, Nguyen Thai Ngoc Duy wrote:
>> On 05/21/2012 05:52 PM, Nguyen Thai Ngoc Duy wrote:
>>> Hi,
>>>
>>> With recent git, "git log --stat 90e6ef5", the first commit's diffstat
>>> uses full terminal width while the next one uses less than 80 chars.
>>> Both changes one file. Is it intentional? I tend to think it's a bug
>>> because with one-file changes, diffstat width is not important as we
>>> have no other files to compare with.
> It just looks weird that while most of the commits fill half of my
> screen (200 char width), some diffstats strike a line through the
> right edge. And I did not see the reason for that in the beginning
> because I thought long lines only makes sense when compare to other
> lines.

A side note: 'git diff --stat-graph-width=N' or 'git config
diff.statGraphWidth N' can be used to limit the width of the graph part.
I don't use it myself, but it could be useful if you have a really wide
terminal.

Zbyszek

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

end of thread, other threads:[~2012-05-22 16:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 15:52 diffstat witdth with one changed file Nguyen Thai Ngoc Duy
2012-05-21 17:33 ` Andreas Schwab
2012-05-21 22:20   ` Junio C Hamano
2012-05-22  5:59 ` Zbigniew Jędrzejewski-Szmek
2012-05-22 12:50   ` Nguyen Thai Ngoc Duy
2012-05-22 16:47     ` Zbigniew Jędrzejewski-Szmek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.