[PATCH v8 0/4] graph: indent visual roots in graph
From: Pablo Sabater <hidden>
Date: 2026-07-10 10:37:39
When rendering a graph, if the history contains multiple "visual roots", actual roots or commits that look like roots (i.e. have their parents filtered out) can end up being vertically adjacent to unrelated commits, falsely appearing to be related. A fix for this issue was already attempted [1] a while ago. This series adds indentation to the visual root commits, so they cannot be vertically adjacent anymore making it easier to identify them. Before indentation: * A * B1 * B2 * C1 * C2 After indentation: * A * B1 \ * B2 * C1 * C2 Indents the visual root commits that have still commits to show after them, and if they have children it connects them with an edge at a new row. If there are multiple visual roots adjacent in history, the indentation starts with the second one, avoiding redundant indentation of the first one and cascades after the second. * A * B * C * D1 * D2 This series first commit is a cleanup that brings a common function from t4215 and t6016 to a graph functions file which they both use, so the new test file for indentation, t4218, can use it as well. GitHub CI: https://github.com/pabloosabaterr/git/actions/runs/29082267633 [1]: https://lore.kernel.org/git/xmqqwnwajbuj.fsf@gitster.c.googlers.com/ (local) V7 DIFF: - New commit (2nd) "revision: add next_commit_to_show()" I wanted to drop (!revs->max_count_stage && !revs->reverse_output_stage) because --reverse is not compatible with --graph and I wanted the indentation to work with --max-count-oldest. Dropping it broke tests at t4202 because the lookahead buffer was being populated from a different source. This new commit adds a helper to get the commits for the lookahead from the same source. - Typos and style. - Added --max-count and --max-count-oldest tests. - graph_get_lookahead_room() now uses ARRAY_SIZE() instead of the hardcoded size 2. - Added an assert on graph_pop_lookahead() Signed-off-by: Pablo Sabater <redacted> --- Pablo Sabater (4): lib-log-graph: move check_graph function revision: add next_commit_to_show() graph: add a 2 commit buffer for lookahead graph: indent visual root in graph graph.c | 286 +++++++++++++++++ graph.h | 17 ++ revision.c | 48 ++- t/lib-log-graph.sh | 5 + t/meson.build | 1 + t/t4215-log-skewed-merges.sh | 33 +- t/t4218-log-graph-indentation.sh | 473 +++++++++++++++++++++++++++++ t/t6016-rev-list-graph-simplify-history.sh | 25 +- 8 files changed, 843 insertions(+), 45 deletions(-) base-commit: f85a7e662054a7b0d9070e432508831afa214b47