Re: [PATCH v11 7/7] graph: add --[no-]graph-indent and log.graphIndent
On Mon, 13 Jul 2026 at 22:14, Pablo Sabater <pabloosabaterr@gmail.com> wrote:
Show 48 quoted lines
>
> Some users may prefer to not have graph indentation.
>
> Add "log.graphIndent" config variable to graph_read_config() to read the
> default preference. By default is graph indentation is true.
>
> Add --graph-indent and --no-graph-indent options to overwrite the
> default preference.
>
> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
> ---
> Documentation/config/log.adoc | 4 +++
> Documentation/rev-list-options.adoc | 8 ++++++
> graph.c | 10 +++++--
> revision.c | 9 +++++++
> revision.h | 2 ++
> t/t4218-log-graph-indentation.sh | 52 +++++++++++++++++++++++++++++++++++++
> 6 files changed, 83 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config/log.adoc b/Documentation/config/log.adoc
> index 757a7be196..f7dfce69b5 100644
> --- a/Documentation/config/log.adoc
> +++ b/Documentation/config/log.adoc
> @@ -59,6 +59,10 @@ This is the same as the `--decorate` option of the `git log`.
> A list of colors, separated by commas, that can be used to draw
> history lines in `git log --graph`.
>
> +`log.graphIndent`::
> + If `true`, indent visual roots when rendering the graphs with `--graph`.
> + Set true by default. It can be overriden with `--[no-]graph-indent`.
> +
> `log.showRoot`::
> If true, the initial commit will be shown as a big creation event.
> This is equivalent to a diff against an empty tree.
> diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc
> index eaee6ee839..af74f10bb4 100644
> --- a/Documentation/rev-list-options.adoc
> +++ b/Documentation/rev-list-options.adoc
> @@ -1269,6 +1269,14 @@ This implies the `--topo-order` option by default, but the
> By default it is set to 0 (no limit), zero and negative values
> are ignored and treated as no limit.
>
> +`--no-graph-indent`::
> +`--graph-indent`::
> + 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
s/deafault/default
Also, I think you meant log.graphIndent instead of graph.indent here.
[snip]
Show 51 quoted lines
> +test_expect_success '--no-graph-indent disables indentation' '
> + lib_test_check_graph --no-graph-indent _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 <<-\EOF
> + * 67_A
> + * 66_A
> + * 65_A
> + * 64_A
> + * 63_A
> + * 62_A
> + * 61_A
> + * 60_A
> + * 59_A
> + * 58_B
> + * 58_A
> + EOF
> +'
> +
> +test_expect_success 'log.graphIndent config disables indentation' '
> + test_config log.graphIndent false &&
> + lib_test_check_graph _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 <<-\EOF
> + * 67_A
> + * 66_A
> + * 65_A
> + * 64_A
> + * 63_A
> + * 62_A
> + * 61_A
> + * 60_A
> + * 59_A
> + * 58_B
> + * 58_A
> + EOF
> +'
> +
> +test_expect_success '--graph-indent forces indentation when graph.indent is unset' '
> + test_config log.graphIndent false &&
> + lib_test_check_graph --graph-indent _58 _59 _60 _61 _62 _63 _64 _65 _66 _67 <<-\EOF
> + * 67_A
> + * 66_A
> + * 65_A
> + * 64_A
> + * 63_A
> + * 62_A
> + * 61_A
> + * 60_A
> + * 59_A
> + * 58_B
> + * 58_A
> + EOF
> +'
> +
> +# graph.indent true and no --option is the default state.