git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root

From
CPChandra Pratap <chandrapratap3519@gmail.com>
Date
May 19, 2026, 10:39 UTC
Message-ID
<CA+J6zkSj+Bfa70h-wW8JRcWtUbFiYJyrdpdLJZ16fY7u7gwECg@mail.gmail.com>
In-Reply-To
<CAN5EUNQoKRqt3FGLmzRGpPU1nO5jCAogP8Wm9gBZXuPbMNbQAw@mail.gmail.com>
On Mon, 18 May 2026 at 18:57, Pablo Sabater <pabloosabaterr@gmail.com> wrote:
Show 139 quoted lines
>
> Hi Chandra, Phillip,
>
> > > >
> > > > I have mixed feelings about which approach to choose.
> > > > The idea of a blank line was thought at
> > > > https://lore.kernel.org/git/xmqq8s8vvw9m.fsf@gitster.c.googlers.com/
> > > > but Junio argued against it for having an extra row because the
> > > > indentation he proposed didn't collapse, however I find indentation +
> > > > no collapse the most confusing one.
> > > > I'd say that I'm fine with both approaches, blank line or indentation
> > > > + collapse.
> > >
> > > I'm afraid I don't understand this - what does it mean for the
> > > indentation to collapse, or not collapse.
>
> Collapsing would be when branches move to the left, eg:
>
>   *
>   |\     <- merge
>   | *
>   |/     <- collapse
>   *
> > > Looking at the examples Junio
> > > gave they look quite nice to me, though I'd find it clearer if
> > >
> > >
> > >   | | *  12345678 2021-01-14 merge xxxxx@xxxx into the history
> > >   | | |\
> > >   | | | \
> > >   | | *  \  23456789 2021-01-12 merge citest into the main history
> > >   | | |\  * 5505e019c2 2014-07-09 initial xxxxxx@xxxx
> > >   | | | *  3e658f4085 2019-09-10 (wiki/wip-citest, origin/wip-citest)
> > > Added defau
> > >   | | | *  ad148aafe6 2019-09-10 Added default CI/CD Jenkinsfile (from
> > > f7daf088)
> > >
> > > was rendered as
> > >
> > >
> > >   | | *  12345678 2021-01-14 merge xxxxx@xxxx into the history
> > >   | | |\
> > >   | | | *  5505e019c2 2014-07-09 initial xxxxxx@xxxx
> > >   | | *    23456789 2021-01-12 merge citest into the main history
> > >   | | |\
> > >   | | | *  3e658f4085 2019-09-10 (wiki/wip-citest, origin/wip-citest)
> > > Added defau
> > >   | | | *  ad148aafe6 2019-09-10 Added default CI/CD Jenkinsfile (from
> > > f7daf088)
> >
> > It probably *does* look clearer here, but I have the same reservations
> > against this as Junio: the break won't be as noticeable when --graph is
> > *not* used with --oneline.
> >
> > > >>> without the patch:
> > > >>>
> > > >>>     * A root
> > > >>>     * B root
> > > >>>     * C root
> > > >>>     * D1 child
> > > >>>     * D root
> > > >>>
> > > >>> with the patch, the indentation cascades:
> > > >>>
> > > >>>     * A root
> > > >>>       * B root
> > > >>>         * C root
> > > >>>           * D1 child
> > > >>>        _ /
> > > >>>       /
> > > >>>      /
> > > >>>     * D root
> > > >
> > > >    * A root
> > > >
> > > >    * B root
> > > >
> > > >    * C root
> > > >
> > > >    * D1 child
> > > >
> > > >    * D root
> > > >
> > > > Here I think a blank line looks worse, too much space for just 5
> > > > commits and becomes one extra line which if this were like up to 7 or
> > > > more parentless commits one after the other would be more noticeable.
> > >
> > > But there shouldn't be a blank line between D and D1 so the two
> > > alternatives take up the same amount of vertical space, the main
> > > difference being whether D1 appears next to D
> > >
> > >      * A root     * A root
> > >                     * B root
> > >      * B root         * C root
> > >                         * D1 child
> > >      * C root         _/
> > >                     /
> > >      * D1 child    /
> > >      * D root     * D root
> > >
> > > Of course if the indentation was smarter it would take up less room and
> > > look better than having blank lines
> > >
> > >      * A root
> > >        * B root
> > >          * C root
> > >      * D1 child
> > >      * D root
> >
> > Right, this would be ideal but that would require too much change to the
> > existing graphing logic, and should be its own patch.
>
> For the examples I'll use the term parentless instead of root, as
> boundary commits are excluded even if they are roots.
> By having is_parentless as a flag in 'git_graph' that every stage can
> access we could modify the rendering and maybe completely drop the
> commit placeholders, working on it for v4 but currently renders like
> this
>
>     * A parentless
>       * B parentless
>         * C parentless
>   * D1 child
>   * D parentless
>
> (A has indentation when it could not have, but that would require a
> lookahead if the next commit is also parentless)
> But definitely a step forward.
>
> Do we want cascading or just a fixed indentation?
>
>     * A parentless
>     * B parentless
>     * C parentless
>   * D1 child
>   * D parentless
>
> By being indented it indicates that it is parentless and that the one
> below doesn't relate to it, but cascading looks clearer.
Agreed, let's keep the cascading.
Show 100 quoted lines
> >
> > > > But there are cases that blank line might be better:
> > > >
> > > >    * 10_A2
> > > >    * 10_A1
> > > >    * 10_A
> > > >      *   10_M
> > > >     /|\
> > > >    | | * 10_D
> > > >    | * 10_C
> > > >    * 10_B
> > > >
> > > > Feels like a shower of commits instead of an indented merge.
> > >
> > > Yes, that is a bit confusing. I think the thing I find confusing with
> > > this approach is that we're treating the commit rendered below the root
> > > commit specially, rather than treating the root commit itself specially.
> > > To me it is the root commit that's the odd one out because it does not
> > > have any parents, but we treat the commit that's rendered below as the
> > > odd one by indenting it relative to its parents.
> >
> > I guess that would make the examples look something like this:
> >
> >   * A root
> >   * B root
> >   * C root
> > * D1 child
> > * D root
> >
> > No cascading, and no need for that massive _ / collapse line.
> >
> > * 10_A2
> > * 10_A1
> >  \
> >   * 10_A
> > *   10_M
> > | \ \
> > | | * 10_D
> > | * 10_C
> > * 10_B
> >
> > I say it looks better than the alternatives, but I'm not sure if this will
> > be easy to implement. The diagonal connection line (\) will need to
> > be printed before printing the actual root commit, which will require
> > lookahead logic.
> >
> > I'd prefer to avoid major surgery on the codebase.
>
> Octopus merges need a pre-commit phase where an additional row
> increases the space around a commit with multiple parents to make room
> for it.
> A new phase can be created similarly to pre-commit as pre-root where
> the connection edge (\) can be printed before the indented commit.
>
> So far this is the comparison:
>
> indentation at root:
>
>     * A parentless
>   * B1 child
>    \
>     * B parentless
>   * C1 child
>   * C parentless
>
> indentation AFTER the root (current v3):
>
>   * A parentless
>     * B1 child
>    /
>   * B parentless
>     * C1 child
>    /
>   * C parentless
>
> Karthik mentioned that by indenting the parentless, we lose the
> consistency of having the roots on their real column and now some are
> indented and some are not.
> The biggest winner having the parentless indented are the merge commits:
>
>   * A child
>   * A child
>     \
>       * A parentless
>   *-.   B child
>   | \ \
>   | |  * C parentless
>   | * D parentless
>   * E parentless
>
> which IMO looks clearer than the commit shower:
>
>   * A child
>   * A child
>   * A parentless
>     *   B child
>    /|\
>   | | * C parentless
>   | * D parentless
>   * E parentless

I guess we're deciding between cleaner root (parentless) commits and cleaner merge commits. I favour merge commits because they appear much more frequently in most codebases.

Show 9 quoted lines
> >
> >
> > Thanks,
> > Chandra.
>
> Regards
>
> --
> Pablo
Previous: Pablo Sabater
Message 119 of 119 in “graph: add indentation for commits preceded by a root”
  1. 0/1 graph: add indentation for commits preceded by a rootPablo Sabater, Apr 2, 2026
  2. 1/1 graph: add indentation for commits preceded by a rootPablo Sabater, Apr 2, 2026
  3. Junio C HamanoApr 3, 2026
  4. PabloApr 3, 2026
  5. Junio C HamanoApr 3, 2026
  6. PabloApr 3, 2026
  7. 0/1 graph: add indentation for commits preceded by a parentless commitPablo Sabater, Apr 4, 2026
  8. 1/1 graph: add indentation for commits preceded by a parentless commitPablo Sabater, Apr 4, 2026
  9. PabloApr 10, 2026
  10. Junio C HamanoApr 10, 2026
  11. 0/1 graph: add indentation for commits preceded by a parentless commitPablo Sabater, Apr 27, 2026
  12. 1/1 graph: add indentation for commits preceded by a parentless commitPablo Sabater, Apr 27, 2026
  13. Jeff KingMay 13, 2026
  14. Pablo SabaterMay 14, 2026
  15. PabloApr 27, 2026
  16. 0/2 graph: indent visual roots in graphPablo Sabater, Jun 12, 2026
  17. 1/2 lib-log-graph: move check_graph functionPablo Sabater, Jun 12, 2026
  18. 2/2 graph: indent visual root in graphPablo Sabater, Jun 12, 2026
  19. Junio C HamanoJun 13, 2026
  20. 0/2 graph: indent visual roots in graphPablo Sabater, Jun 13, 2026
  21. 1/2 lib-log-graph: move check_graph functionPablo Sabater, Jun 13, 2026
  22. 2/2 graph: indent visual root in graphPablo Sabater, Jun 13, 2026
  23. Junio C HamanoJun 14, 2026
  24. Pablo SabaterJun 14, 2026
  25. Junio C HamanoJun 15, 2026
  26. Pablo SabaterJun 16, 2026
  27. Junio C HamanoJun 16, 2026
  28. Jeff KingJun 17, 2026
  29. Pablo SabaterJun 18, 2026
  30. Junio C HamanoJun 18, 2026
  31. Jeff KingJun 18, 2026
  32. Jeff KingJun 18, 2026
  33. Kristofer KarlssonJun 19, 2026
  34. Jeff KingJun 21, 2026
  35. Kristofer KarlssonJun 22, 2026
  36. Chandra PratapJun 17, 2026
  37. 0/3 graph: indent visual roots in graphPablo Sabater, Jun 20, 2026
  38. 1/3 lib-log-graph: move check_graph functionPablo Sabater, Jun 20, 2026
  39. 2/3 revision: add peek functions for lookaheadPablo Sabater, Jun 20, 2026
  40. Pablo SabaterJun 20, 2026
  41. Junio C HamanoJun 20, 2026
  42. Junio C HamanoJun 20, 2026
  43. Junio C HamanoJun 21, 2026
  44. Chandra PratapJun 21, 2026
  45. Kristofer KarlssonJun 22, 2026
  46. Junio C HamanoJun 29, 2026
  47. Pablo SabaterJun 29, 2026
  48. 3/3 graph: indent visual root in graphPablo Sabater, Jun 20, 2026
  49. 0/3 graph: indent visual roots in graphPablo Sabater, Jul 4, 2026
  50. 1/3 lib-log-graph: move check_graph functionPablo Sabater, Jul 4, 2026
  51. 2/3 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 4, 2026
  52. Chandra PratapJul 6, 2026
  53. Kristofer KarlssonJul 6, 2026
  54. Chandra PratapJul 6, 2026
  55. Pablo SabaterJul 7, 2026
  56. Pablo SabaterJul 7, 2026
  57. 3/3 graph: indent visual root in graphPablo Sabater, Jul 4, 2026
  58. 0/4 graph: indent visual roots in graphPablo Sabater, Jul 10, 2026
  59. 1/4 lib-log-graph: move check_graph functionPablo Sabater, Jul 10, 2026
  60. 2/4 revision: add next_commit_to_show()Pablo Sabater, Jul 10, 2026
  61. 3/4 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 10, 2026
  62. 4/4 graph: indent visual root in graphPablo Sabater, Jul 10, 2026
  63. Mirko FainaJul 10, 2026
  64. Pablo SabaterJul 10, 2026
  65. 0/4 graph: indent visual roots in graphPablo Sabater, Jul 11, 2026
  66. 1/4 lib-log-graph: move check_graph functionPablo Sabater, Jul 11, 2026
  67. 2/4 revision: add next_commit_to_show()Pablo Sabater, Jul 11, 2026
  68. 3/4 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 11, 2026
  69. 4/4 graph: indent visual root in graphPablo Sabater, Jul 11, 2026
  70. Mirko FainaJul 11, 2026
  71. Pablo SabaterJul 11, 2026
  72. Mirko FainaJul 11, 2026
  73. Chandra PratapJul 12, 2026
  74. Mirko FainaJul 12, 2026
  75. Mirko FainaJul 12, 2026
  76. Pablo SabaterJul 12, 2026
  77. Mirko FainaJul 12, 2026
  78. Chandra PratapJul 13, 2026
  79. 0/7 graph: indent visual roots in graphPablo Sabater, Jul 13, 2026
  80. 1/7 lib-log-graph: move check_graph functionPablo Sabater, Jul 13, 2026
  81. 2/7 revision: add next_commit_to_show()Pablo Sabater, Jul 13, 2026
  82. 3/7 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 13, 2026
  83. 4/7 graph: indent visual root in graphPablo Sabater, Jul 13, 2026
  84. 5/7 graph: wrap cascading commits after 4 columnsPablo Sabater, Jul 13, 2026
  85. 6/7 graph: move config reading into graph_read_config()Pablo Sabater, Jul 13, 2026
  86. 7/7 graph: add --[no-]graph-indent and log.graphIndentPablo Sabater, Jul 13, 2026
  87. Mirko FainaJul 13, 2026
  88. Pablo SabaterJul 13, 2026
  89. 0/7 graph: indent visual roots in graphPablo Sabater, Jul 13, 2026
  90. 1/7 lib-log-graph: move check_graph functionPablo Sabater, Jul 13, 2026
  91. 2/7 revision: add next_commit_to_show()Pablo Sabater, Jul 13, 2026
  92. 3/7 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 13, 2026
  93. 4/7 graph: indent visual root in graphPablo Sabater, Jul 13, 2026
  94. 6/7 graph: move config reading into graph_read_config()Pablo Sabater, Jul 13, 2026
  95. 7/7 graph: add --[no-]graph-indent and log.graphIndentPablo Sabater, Jul 13, 2026
  96. Chandra PratapJul 14, 2026
  97. Pablo SabaterJul 14, 2026
  98. 5/7 graph: wrap cascading commits after 4 columnsPablo Sabater, Jul 13, 2026
  99. Junio C HamanoJul 13, 2026
  100. Pablo SabaterJul 13, 2026
  101. 0/7 graph: indent visual roots in graphPablo Sabater, Jul 14, 2026
  102. 1/7 lib-log-graph: move check_graph functionPablo Sabater, Jul 14, 2026
  103. 2/7 revision: add next_commit_to_show()Pablo Sabater, Jul 14, 2026
  104. 3/7 graph: add a 2 commit buffer for lookaheadPablo Sabater, Jul 14, 2026
  105. 4/7 graph: indent visual root in graphPablo Sabater, Jul 14, 2026
  106. 5/7 graph: wrap cascading commits after 4 columnsPablo Sabater, Jul 14, 2026
  107. 6/7 graph: move config reading into graph_read_config()Pablo Sabater, Jul 14, 2026
  108. 7/7 graph: add --[no-]graph-indent and log.graphIndentPablo Sabater, Jul 14, 2026
  109. Chandra PratapJul 15, 2026
  110. Phillip WoodMay 14, 2026
  111. Pablo SabaterMay 14, 2026
  112. Phillip WoodMay 15, 2026
  113. Chandra PratapMay 17, 2026
  114. Pablo SabaterMay 18, 2026
  115. Junio C HamanoMay 19, 2026
  116. Pablo SabaterMay 19, 2026
  117. Junio C HamanoJun 10, 2026
  118. Pablo SabaterJun 10, 2026
  119. Chandra PratapMay 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.