From: Pablo Sabater <pabloosabaterr@gmail.com>
To: git@vger.kernel.org
Cc: ayu.chandekar@gmail.com, chandrapratap3519@gmail.com,
christian.couder@gmail.com, gitster@pobox.com,
jltobler@gmail.com, karthik.188@gmail.com, peff@peff.net,
phillip.wood@dunelm.org.uk, siddharthasthana31@gmail.com,
Pablo Sabater <pabloosabaterr@gmail.com>
Subject: [PATCH v4 0/2] graph: indent visual roots in graph
Date: Fri, 12 Jun 2026 15:48:29 +0200 [thread overview]
Message-ID: <20260612-ps-pre-commit-indent-v4-0-e8492037ebae@gmail.com> (raw)
In-Reply-To: <20260427102838.44867-1-pabloosabaterr@gmail.com>
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.
The lookahead used to set the cascading and avoid extra indentation is not
completely reliable, as the walker goes through the commits it simplifies the
history of the current commit and its parents, but it doesn't simplify it
for the next unrelated or the grandparents. When the walker simplifies the
history, it removes filtered commits from the history and sets its flags.
When the next commit is an unrelated commit and its parents will be filtered
out, for the lookahead the commit is still a child of, it cannot know that the
next commit once simplified (advancing the walker) it will become a visual root.
This makes the lookahead fail, failing to set the cascading and starting it
with the first visual root, carrying an extra indent for the cascade.
given:
* A unrelated (visual root)
* B child of C
* C visual root WILL BE FILTERED OUT
* D unrelated (visual root)
the actual output is:
* A
* B
* D
A test has been added to t4218 and a NEEDSWORK to the lookahead function to
document this edge case but I'm not that familiar with revision.c. Maybe there's
a better way to make the lookahead more reliable.
[1]: https://lore.kernel.org/git/xmqqwnwajbuj.fsf@gitster.c.googlers.com/
V3 DIFF:
- Completly changes the approach to indent the visual roots instead of the
commits after the visual roots.
Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
---
Pablo Sabater (2):
lib-log-graph: move check_graph function
graph: indent visual root in graph
graph.c | 262 +++++++++++++++++
t/lib-log-graph.sh | 5 +
t/meson.build | 1 +
t/t4215-log-skewed-merges.sh | 33 +--
t/t4218-log-graph-indentation.sh | 455 +++++++++++++++++++++++++++++
t/t6016-rev-list-graph-simplify-history.sh | 25 +-
6 files changed, 747 insertions(+), 34 deletions(-)
---
base-commit: 3e65291872de10c3f0bf05ea8c24187e7a71ebf0
change-id: 20260612-ps-pre-commit-indent-39ca72816382
Best regards,
--
Pablo Sabater <pabloosabaterr@gmail.com>
next prev parent reply other threads:[~2026-06-12 13:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 21:17 [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root Pablo Sabater
2026-04-02 21:17 ` [GSoC RFC PATCH 1/1] " Pablo Sabater
2026-04-03 17:55 ` Junio C Hamano
2026-04-03 18:07 ` Pablo
2026-04-03 5:04 ` [GSoC RFC PATCH 0/1] " Junio C Hamano
2026-04-03 8:25 ` Pablo
2026-04-04 9:24 ` [GSoC RFC PATCH v2 0/1] graph: add indentation for commits preceded by a parentless commit Pablo Sabater
2026-04-04 9:24 ` [GSoC RFC PATCH v2 1/1] " Pablo Sabater
2026-04-10 16:25 ` [GSoC RFC PATCH v2 0/1] " Pablo
2026-04-10 16:54 ` Junio C Hamano
2026-04-27 10:28 ` [GSoC PATCH v3 " Pablo Sabater
2026-04-27 10:28 ` [GSoC PATCH v3 1/1] " Pablo Sabater
2026-05-13 23:02 ` Jeff King
2026-05-14 10:19 ` Pablo Sabater
2026-04-27 10:35 ` [GSoC PATCH v3 0/1] " Pablo
2026-06-12 13:48 ` Pablo Sabater [this message]
2026-06-12 13:48 ` [PATCH v4 1/2] lib-log-graph: move check_graph function Pablo Sabater
2026-06-12 13:48 ` [PATCH v4 2/2] graph: indent visual root in graph Pablo Sabater
2026-05-14 15:15 ` [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root Phillip Wood
2026-05-14 17:45 ` Pablo Sabater
2026-05-15 9:33 ` Phillip Wood
2026-05-17 6:31 ` Chandra Pratap
2026-05-18 13:26 ` Pablo Sabater
2026-05-19 0:03 ` Junio C Hamano
2026-05-19 5:59 ` Pablo Sabater
2026-06-10 15:21 ` Junio C Hamano
2026-06-10 15:28 ` Pablo Sabater
2026-05-19 10:39 ` Chandra Pratap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260612-ps-pre-commit-indent-v4-0-e8492037ebae@gmail.com \
--to=pabloosabaterr@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=chandrapratap3519@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=siddharthasthana31@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox