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

Re: [RFC/PATCH] graph API: Use horizontal lines for more compact graphs

From
Allan Caffee <allan.caffee@gmail.com>
Date
Apr 21, 2009, 02:23 UTC
Message-ID
<b2e43f8f0904201923hd97f3e3v66addf59daa3956f@mail.gmail.com>
In-Reply-To
<alpine.DEB.1.00.0904210255280.10279@pacific.mpi-cbg.de>

On Mon, Apr 20, 2009 at 8:56 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 28 quoted lines
> Hi,
>
> On Mon, 20 Apr 2009, Allan Caffee wrote:
>
>> diff --git a/graph.c b/graph.c
>> index d4571cf..597e545 100644
>> --- a/graph.c
>> +++ b/graph.c
>> @@ -47,20 +47,6 @@ static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);
>>   * - Limit the number of columns, similar to the way gitk does.
>>   *   If we reach more than a specified number of columns, omit
>>   *   sections of some columns.
>> - *
>> - * - The output during the GRAPH_PRE_COMMIT and GRAPH_COLLAPSING states
>> - *   could be made more compact by printing horizontal lines, instead of
>> - *   long diagonal lines.  For example, during collapsing, something like
>> - *   this:          instead of this:
>> - *   | | | | |      | | | | |
>> - *   | |_|_|/       | | | |/
>> - *   |/| | |        | | |/|
>> - *   | | | |        | |/| |
>> - *                  |/| | |
>> - *                  | | | |
>> - *
>> - *   If there are several parallel diagonal lines, they will need to be
>> - *   replaced with horizontal lines on subsequent rows.
>
> I like it!
:) Good!
>> +                             for (j = (target * 2)+3; j < (i - 2); j += 2)
>
> This (target*2)+3 is a bit too magical for me to understand.  But maybe I
> am just too tired?

It is a little magical. Here target is an index into graph->new_columns so we double that to get the actual location of the edge in the string for this line. So if we take the example that was in the original TODO:

t(c)
|  t(c) + 3 (i.e. the first horizontal edge)
|  |
v..v    c
| | | | |
| |_|_|/
|/| | |
| | | |

Where c is the "horizontal_edge", t(c) is the target of the "horizontal_edge" and t(c) + 3 is the location of the first horizontal segment. And then of course the += 2 is because we don't want to change the mappings of the existing vertical edges. This could really probably use a comment (suggestions welcome).

Hope that clears things up, ~Allan

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 17 in “graph API: Use horizontal lines for more compact graphs”
  1. graph API: Use horizontal lines for more compact graphsAllan Caffee, Apr 21, 2009
  2. Johannes SchindelinApr 21, 2009
  3. Allan CaffeeApr 21, 2009
  4. Johannes SchindelinApr 21, 2009
  5. graph API: Use horizontal lines for more compact graphsAllan Caffee, Apr 21, 2009
  6. Johannes SchindelinApr 21, 2009
  7. Bug in colored "log --graph" implementationTeemu Likonen, Apr 21, 2009
  8. graph API: fix extra space during pre_commit_line stateAllan Caffee, Apr 21, 2009
  9. Teemu LikonenApr 22, 2009
  10. Allan CaffeeApr 22, 2009
  11. 2/3 graph API: fix extra space during pre_commit_line stateAllan Caffee, Apr 22, 2009
  12. 1/3 t4202-log: extend test coverage of graphingAllan Caffee, Apr 22, 2009
  13. 2/3 graph API: fix extra space during pre_commit_line stateAllan Caffee, Apr 22, 2009
  14. 3/3 graph API: fix a bug in the rendering of octopus mergesAllan Caffee, Apr 22, 2009
  15. Allan CaffeeApr 22, 2009
  16. graph API: Use horizontal lines for more compact graphsAllan Caffee, Apr 27, 2009
  17. Junio C HamanoApr 27, 2009

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.