git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: diffstat witdth with one changed file

From
Junio C Hamano <gitster@pobox.com>
Date
May 21, 2012, 22:20 UTC
Message-ID
<7vehqd6urj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<m2obphcubh.fsf@igel.home>
Andreas Schwab <schwab@linux-m68k.org> writes:
Show 8 quoted lines
> 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.

Previous: Andreas SchwabNext: Zbigniew Jędrzejewski-Szmek
Message 3 of 6 in “diffstat witdth with one changed file”
  1. Nguyen Thai Ngoc DuyMay 21, 2012
  2. Andreas SchwabMay 21, 2012
  3. Junio C HamanoMay 21, 2012
  4. Zbigniew Jędrzejewski-SzmekMay 22, 2012
  5. Nguyen Thai Ngoc DuyMay 22, 2012
  6. Zbigniew Jędrzejewski-SzmekMay 22, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.