From: Pablo Date: Wed, 01 Apr 2026 14:42:26 GMT Subject: Re: [GSoC PATCH v6 0/3] graph: add --graph-lane-limit option Message-ID: In-Reply-To: El mié, 1 abr 2026 a las 10:36, Johannes Sixt () escribió: > > 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. Thanks for testing it on real-world examples and I'm happy that it seems more useful than expected. While working on this I spent most of the time with graph.c and I got to understand well how the rendering engine works. I think I have an idea about how to tackle the column rearrangement like gitk, which I believe is what you thought it was about at the start (and the TODO that's been on graph.c for 16 years c12172d2ea). FWIW, I'd like to send an RFC about the column rearrangement because it would be better overall, no information is lost, you can still limit the number of visible columns which would replace this in most cases (only scenario I can think of where you still want to keep the truncation would be if you want to keep the branches going straight vertically). I'd like to hold this series and send the RFC with the idea for the rearrangement. If it ends up not being viable I would come back here and add a 4th patch to remove the extra padding lines (merge and collapsing lines truncated) to make it more useful making the graph more compact vertically as well. I'm sorry if this ends up not being merged and I've wasted your time. > > 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. IIRC there's one place where the ~ padding comes from if it's in an uneven column, I think it might be what's failing. Thanks. > > -- Hannes > I'm still new to Git and even though I've read the documentation I may have missed something, if something about what I'm saying to do (The RFC, holding this) is wrong please let me know. Thanks for the feedback and the reviews, Pablo.