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

Re: [PATCH v2 2/3] Adjust stat width calculations to take --graph output into account

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2012, 20:45 UTC
Message-ID
<7vd384wejl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1332444461-11957-2-git-send-email-lucian.poston@gmail.com>
Lucian Poston <lucian.poston@gmail.com> writes:
Administrivia: You seem to be CC'ing people who haven't touched any of
the surrounding code for quite some time, including the now-defunct
address of mine.  Please don't.
Show 12 quoted lines
> Adjust stat width calculations to reserve space for required characters before
> scaling the widths for the filename and graph portions of the diff-stat. For
> example, consider:
>
> " diff.c |   66 ++-"
>
> Before calculating the widths allocated to the filename, "diff.c", and the
> graph, "++-", reserve space for the initial " " and the part between the
> filename and graph portions " |   66 ". Then, divide the remaining space so
> that 5/8ths is given to the filename and 3/8ths for the graph.
>
> Update the affected test, t4502.
That explains the regression you are introducing, but does not justify it.

When you start showing that line, do you already know how many columns at the left edge of the display will be consumed by the ancestry graph part?

When the command is run without "--graph" option, the answer would obviously be zero, but if it is non-zero, wouldn't it be a more sensible solution to the problem to subtract that width from the total allowed display width (e.g. on 200-column terminal, if the ancestry graph part at the left edge uses 20-columns, you do exactly the same as the current algorithm but use 180 as the width of the terminal). When --stat-width is explicitly given, that specifies the width of whatever comes after the ancestry graph part, so there is no need to change anything.

Am I missing something, or is there something deeper going on?
Previous: Lucian PostonNext: Lucian Poston
Message 5 of 15 in “Add output_prefix_length to diff_options”
  1. 1/3 Add output_prefix_length to diff_optionsLucian Poston, Mar 22, 2012
  2. 2/3 Adjust stat width calculations to take --graph output into accountLucian Poston, Mar 22, 2012
  3. Zbigniew Jędrzejewski-SzmekMar 22, 2012
  4. Lucian PostonMar 23, 2012
  5. Junio C HamanoMar 22, 2012
  6. Lucian PostonMar 23, 2012
  7. Lucian PostonMar 23, 2012
  8. Zbigniew Jędrzejewski-SzmekMar 23, 2012
  9. Lucian PostonApr 12, 2012
  10. Zbigniew Jędrzejewski-SzmekApr 12, 2012
  11. Lucian PostonApr 16, 2012
  12. Junio C HamanoMar 23, 2012
  13. Lucian PostonApr 12, 2012
  14. 3/3 t4052: Test that stat width is adjusted for prefixesLucian Poston, Mar 22, 2012
  15. Lucian PostonMar 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.