Subject: Re: [GSoC PATCH v6 0/3] graph: add --graph-lane-limit option

From: Johannes Sixt <[email-masked]>
Date: Wed, 1 Apr 2026 10:36:18 +0200

Am 28.03.26 um 01:11 schrieb Pablo Sabater:
> Repositories that have many active branches at the same time produce
> wide graphs. A lane consists of two columns, the edge and the space
> padding, each branch takes a lane in the graph and there is no way
> to limit how many can be shown.
> 
> The limit is a horizontal truncation, each lane is cut at the lane limit:
> 
>   Without --graph-lane-limit:
> 
>   *   7_M1
>   |\  
>   | * 7_E
>   * | 7_C
>   | | *   7_M2
>   | | |\  
>   | | | * 7_H
>   | | |/  
>   | |/|   
>   | * | 7_D
>   | | * 7_G
>   | | * 7_F
>   | |/  
>   |/|   
>   * | 7_B
>   |/  
>   * 7_A
> 
>   With --graph-lane-limit=1:
> 
>   *   7_M1
>   |\  
>   | * 7_E
>   * ~ 7_C
>   | ~ 7_M2
>   | ~ 7_H
>   | ~ 
>   | ~ 
>   | * 7_D
>   | ~ 7_G
>   | ~ 7_F
>   | ~ 
>   |/~ 
>   * ~ 7_B
>   |/  
>   * 7_A

After seeing this example, my first reaction was that this
--graph-lane-limit option would not be useful for me. The relationship
among the commits is apparently obfuscated to such a degree that the
graph is not a lot better than a plain listing without --graph.

But then I tried on a few real-world examples, and the result turned out
to be a lot better. The commits (asterisks) typically occur in the
left-most lanes, and the lanes to the right are usually just connections
without commits. This makes it more practical to just truncate the graph
part, i.e., hide the connecting lanes.

In conclusion, I regard the way the option works as useful, even though
it is not the way of truncation I had envisioned originally.

I discovered a small glitch, though. If you download today's gitk
repository https://github.com/j6t/gitk.git, run

  git log --graph --oneline --decorate --boundary \
     --graph-lane-limit=4 465f03869ae11acd0..origin/j6t-testing

(j6t-testing is a volatile branch and is 86848fe40b60ae58f today).
Scroll down to line 166 and you see the '~' at the wrong place:

| | * | ~ 9f0d1c2 gitk: sanitize 'exec' arguments: simple cases
| | * | ~ 6eb797f gitk: have callers of diffcmd supply pipe symbol...
| | * | ~ b966b73 gitk: treat file names beginning with "|" as...
* | | | ~ 0c8be6f Merge branch 'ah/fix-open-with-stdin'
|\| | |~           <-- this is line 166
| * | | ~ 8e3070a (...) gitk: encode arguments correctly with "open"
* | | | ~ bfb0fa7 Merge branch 'top-panel-search-highlight' of ...
|\ \ \ \~
| * | | ~ 9cad4a9 gitk: do not hard-code color of search results...

I haven't tried to find out what is going wrong here or to simplify the
reproducer.

-- Hannes