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

Re: [PATCH 0/3] log --graph and rev-list --graph

From
Adam Simpkins <adam@adamsimpkins.net>
Date
May 5, 2008, 06:19 UTC
Message-ID
<20080505061940.GA26319@adamsimpkins.net>
In-Reply-To
<46dff0320805041913t31c05a36w92be4a81a3da07af@mail.gmail.com>
On Mon, May 05, 2008 at 10:13:43AM +0800, Ping Yin wrote:
Show 8 quoted lines
> 
> Is the indention between ba7f5b and 38254 intentional?
> 
> * ba7f5b log and rev-list: add --graph option
> *   38254 Add history graph API
> *   12918 revision API: split parent rewriting
> *   c697a Cleanup xread() loops to use read_in_full()
> M     47179 Merge branch 'maint'

It's not really intentional, it's just the result of a rather simplistic computation.

The amount of horizontal padding used for each commit is computed as (2 * number of incoming columns from the previous commit) + (2 * number of parents of the current commit). This always results in enough padding. However, if the current commit is a child of one of the incoming columns, it results in 2 more spaces than necessary.

There's a comment in graph_pad_horizontally() graph.c that describes this behavior:

     * This computation results in 3 extra spaces to the right in most
     * cases, but only 1 extra space if the commit doesn't have any
     * children that have already been displayed in the graph (i.e.,
     * if the current commit isn't in graph->columns).

It could easily be fixed by performing an extra pass over the columns to check if any of the existing columns refers to the current commit.

I'll try to come up with a patch when I get the chance.
-- 
Adam Simpkins
adam@adamsimpkins.net
Previous: Ping YinNext: Teemu Likonen
Message 12 of 13 in “log --graph and rev-list --graph”
  1. 0/3 log --graph and rev-list --graphAdam Simpkins, May 4, 2008
  2. 1/3 revision API: split parent rewriting and parent printing optionsAdam Simpkins, May 4, 2008
  3. 2/3 Add history graph APIAdam Simpkins, May 4, 2008
  4. 3/3 log and rev-list: add --graph optionAdam Simpkins, May 4, 2008
  5. graph API: eliminate unnecessary indentationAdam Simpkins, May 5, 2008
  6. Ping YinMay 5, 2008
  7. Junio C HamanoMay 6, 2008
  8. Adam SimpkinsMay 6, 2008
  9. Junio C HamanoMay 6, 2008
  10. bash: Add more option completions for 'git log'Teemu Likonen, May 4, 2008
  11. Ping YinMay 5, 2008
  12. Adam SimpkinsMay 5, 2008
  13. Teemu LikonenMay 6, 2008

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.