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

Re: [PATCH 0/8 v6] diff --stat: use the full terminal width

From
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date
Feb 22, 2012, 11:24 UTC
Message-ID
<4F44D084.7030308@in.waw.pl>
In-Reply-To
<7v1upogd6w.fsf@alter.siamese.dyndns.org>
On 02/21/2012 09:10 PM, Junio C Hamano wrote:
Show 19 quoted lines
> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:
>
>> This seem overly complex. A nice property to have would be
>> "if the window is wide enough so there's enough space for full
>> filenames, the graph part scales monotonically with the change count".
>> (If there's filename truncation, than there just isn't enough space
>> for everything and the graph may be compressed. But otherwise, if we
>> have two graphs which do not end at the edge of the screen, and the
>> second one is wider than the first one, then without looking at the
>> change counts we know that the second one has more changes).
>>
>> For this property to be satisfied, the graph_width limit would have to
>> be independent of the filename width.
>>
>> So maybe it should be ...
>
> Sorry, the desired property I would understand, but that does not click
> with your "have to be independent" conclusion, so I do not have comment on
> the "maybe it should be..." part.
Hi,
by "scales monotonically with the change count" I meant with two 
different commits. Image that there are two commits
   a | 300 ++++++++++++++++++++++
and
   a/a/a/b | 300 ++++++++++++++++++++++
Both commits have the same change count, but filenames of different 
length. If the filename length can influence the number of "+" in the 
graph, then the scaling is not monotonic. There would always be cases 
when a bigger change with longer filenames has a narrower graph.
Show 13 quoted lines
> The resolution requirement may want to set a "desired lower limit" for the
> width of the graph, but it is only "desired" because it is possible that
> you have to bust the limit if you have three files with 1, 9999 and 10000
> changed lines and your terminal is only 200 columns wide.
>
> The current code caps name part to 50/80, but allows the graph to use more
> when you have only shorter names.  Perhaps you can follow the same logic
> in the first part of your [7/8] (which needs to be separated to at least
> in two pieces, as it conflates the "lift 50-column cap from the name width
> and make it proportional to the term_width()" part and "but cap the graph
> part to 40-column" part, that are separate topics)?  Then we can try
> different heuristics to find a better way to cap the length of the graph
> on top?
Sure. I'll be replying to this mail with patches
  [7.1/8] use a maximum of 5/8 for the filename part
  [7.2/8] add a test for output with COLUMNS=40
  [7.3/8] limit graph part to 40 columns

-- Zbyszek

Previous: Junio C HamanoNext: Zbigniew Jędrzejewski-Szmek
Message 15 of 35 in “diff --stat: use the full terminal width”
  1. 0/8 diff --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  2. 1/8 make lineno_width() from blame reusable for othersZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  3. 2/8 diff --stat: tests for long filenames and big change countsZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  4. 3/8 diff --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  5. 4/8 show --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  6. 5/8 log --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  7. 6/8 merge --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  8. 7/8 diff --stat: limit graph part to 40 columnsZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  9. 8/8 diff --stat: use less columns for change countsZbigniew Jędrzejewski-Szmek, Feb 20, 2012
  10. Junio C HamanoFeb 20, 2012
  11. Zbigniew Jędrzejewski-SzmekFeb 21, 2012
  12. Junio C HamanoFeb 21, 2012
  13. Zbigniew Jędrzejewski-SzmekFeb 21, 2012
  14. Junio C HamanoFeb 21, 2012
  15. Zbigniew Jędrzejewski-SzmekFeb 22, 2012
  16. 1/8 diff --stat: use a maximum of 5/8 for the filename partZbigniew Jędrzejewski-Szmek, Feb 22, 2012
  17. 2/8 diff --stat: add a test for output with COLUMNS=40Zbigniew Jędrzejewski-Szmek, Feb 22, 2012
  18. 3/8 diff --stat: limit graph part to 40 columnsZbigniew Jędrzejewski-Szmek, Feb 22, 2012
  19. Junio C HamanoFeb 22, 2012
  20. 0/11 diff --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  21. 01/11 make lineno_width() from blame reusable for othersZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  22. 02/11 diff --stat: tests for long filenames and big change countsZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  23. 03/11 diff --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  24. 04/11 show --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  25. 05/11 log --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  26. 06/11 merge --stat: use the full terminal widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  27. 07/11 diff --stat: use a maximum of 5/8 for the filename partZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  28. 08/11 diff --stat: add a test for output with COLUMNS=40Zbigniew Jędrzejewski-Szmek, Feb 24, 2012
  29. 09/11 diff --stat: enable limiting of the graph partZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  30. 10/11 diff --stat: add config option to limit graph widthZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  31. 11/11 diff --stat: use less columns for change countsZbigniew Jędrzejewski-Szmek, Feb 24, 2012
  32. Nguyen Thai Ngoc DuyFeb 21, 2012
  33. Zbigniew Jędrzejewski-SzmekFeb 21, 2012
  34. Miles BaderFeb 23, 2012
  35. Junio C HamanoFeb 23, 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.