Skip to content

graph: indent visual roots in graph

Pablo Sabater git 9 versions – In review

Get series with b4
b4 am [email protected] change-id 20260612-ps-pre-commit-indent-39ca72816382

Versions newest first

  1. v12 Latest7 patches 1 replyIn review
  2. v117 patches 4 repliesSuperseded
  3. v107 patches 2 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v94 patches9 repliesSuperseded
v84 patches2 repliesSuperseded
v73 patches5 repliesSuperseded
v63 patches8 repliesSuperseded
v52 patches14 repliesSuperseded
v42 patches1 replySuperseded

Patches in v12 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7lib-log-graph: move check_graph functiont/lib-log-graph.sh t/t4215-log-skewed-merges.sh t/t6016-rev-list-graph-simplify-history.sh+29 -340 replies
2/7revision: add next_commit_to_show()revision.c+24 -120 replies
3/7graph: add a 2 commit buffer for lookaheadgraph.c graph.h revision.c+84 -20 replies
4/7graph: indent visual root in graphgraph.c t/meson.build t/t4218-log-graph-indentation.sh+759 -00 replies
5/7graph: wrap cascading commits after 4 columnsgraph.c t/t4218-log-graph-indentation.sh+50 -10 replies
6/7graph: move config reading into graph_read_config()graph.c+9 -40 replies
7/7graph: add --[no-]graph-indent and log.graphIndentDocumentation/config/log.adoc Documentation/rev-list-options.adoc graph.c +3 more+84 -20 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by.

PatchKarthik NayakChandra PratapKristofer Karlsson
1/7Mentored-by Mentored-by
2/7
3/7Helped-by
4/7Mentored-by Mentored-by Helped-by
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v12 thread

Cover letter [PATCH v12 0/7] graph: indent visual roots in graph

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
* D
* E
* F
* G
* H
* I
* J1
* J2

The indentation wraps after cascading columns and when wrapping back to the initial column if the next commit is a non-visual-root commit, force the indentation one extra level.

Series explanation:

1. Cleanup to bring a common function from t4215 and t6016 that will be used in t4218.

2. Logic extraction of the chose of from where the commit source comes from.

3. Add a buffer for lookahead purposes.

4. Principal commit. Implement the logic to get the visual roots indented.

5. Make visual root cascading wrap after 4 columns

6. Add --[no-]graph-indent and log.graphIndent options.

GitHub CI: https://github.com/pabloosabaterr/git/actions/runs/29331144667

[1]: https://lore.kernel.org/git/[email protected]/

V11 DIFF:

- Changed the check that required graph, to not confuse because it is a boolean value.

- Typos

---
Pablo Sabater (7):
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: wrap cascading commits after 4 columns
graph: move config reading into graph_read_config()
graph: add --[no-]graph-indent and log.graphIndent

 Documentation/config/log.adoc              |   4 +
 Documentation/rev-list-options.adoc        |   8 +
 graph.c                                    | 332 +++++++++++++++-
 graph.h                                    |  17 +
 revision.c                                 |  57 ++-
 revision.h                                 |   2 +
 t/lib-log-graph.sh                         |   5 +
 t/meson.build                              |   1 +
 t/t4215-log-skewed-merges.sh               |  33 +-
 t/t4218-log-graph-indentation.sh           | 596 +++++++++++++++++++++++++++++
 t/t6016-rev-list-graph-simplify-history.sh |  25 +-
 11 files changed, 1032 insertions(+), 48 deletions(-)

Range-diff versus v11:

1:  dd0bb0d215 = 1:  d754392142 lib-log-graph: move check_graph function
2:  07e239533d = 2:  c93c2c0771 revision: add next_commit_to_show()
3:  4d71f674a1 = 3:  70fe612ae1 graph: add a 2 commit buffer for lookahead
4:  48ad2562f0 = 4:  e1ac06c4ea graph: indent visual root in graph
5:  45be69d11b = 5:  ce52b41527 graph: wrap cascading commits after 4 columns
6:  8ce53ae21b = 6:  9b7bb2cebc graph: move config reading into graph_read_config()
7:  c1fa81022e ! 7:  13e830725f graph: add --[no-]graph-indent and log.graphIndent
    @@ Documentation/rev-list-options.adoc: This implies the `--topo-order` option by d
     +	When used with `--graph`, indent visual roots (commits with no parents
     +	or whose parents are not shown) to differentiate them from commits that
     +	are vertically adjacent but unrelated. Enabled by default. Use
    -+	`--no-graph-indent` to disable or set `graph.indent` to set a deafault
    -+	preference.
    ++	`--no-graph-indent` to disable or set `log.graphIndent` to set a
    ++	default preference.
     +
      ifdef::git-rev-list[]
      `--count`::
    @@ revision.c: int setup_revisions(int argc, const char **argv, struct rev_info *re
      	if (revs->graph_max_lanes > 0 && !revs->graph)
      		die(_("the option '%s' requires '%s'"), "--graph-lane-limit", "--graph");

    -+	if (revs->graph_indent_set > 0 && !revs->graph)
    ++	if (revs->graph_indent_set && !revs->graph)
     +		die(_("the option '%s' requires '%s'"), "--[no-]graph-indent", "--graph");
     +
      	if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
    @@ t/t4218-log-graph-indentation.sh: test_expect_success 'visual root cascading get
     +	EOF
     +'
     +
    -+# graph.indent true and no --option is the default state.
    ++# log.graphIndent unset and no --option (which activates graph indentation) is
    ++# the default state.
     +
      test_done

---
base-commit: f60db8d575adb79761d363e026fb49bddf330c73