]> git.ipfire.org Git - thirdparty/git.git/commit
graph: wrap cascading commits after 4 columns
authorPablo Sabater <pabloosabaterr@gmail.com>
Tue, 14 Jul 2026 12:09:36 +0000 (14:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Jul 2026 14:32:51 +0000 (07:32 -0700)
commit233cc403310efbb12be7ecba997f7e378c6cc390
treefcf7e9f9725dafea085c2582886b23bfbaa3f06c
parenta34c00d96851009e94ec7618ad5c1464f920c80d
graph: wrap cascading commits after 4 columns

Currently the visual root commits in a graph cascade indefinitely until
a commit which is not a visual root or the last commit appears.
On filters like --author where one author might contribute mostly on
single patches this can become a visual issue.

Make the cascading wrap after 4 columns.

There are two possible cases of the wrap:

1. No ambiguity:

* A
  * B
    * C
      * D
* E
  * F

2. Ambiguous conflict:

If F happens to not be a visual root and E gets wrapped back to the
initial column then E and F would be vertically adjacent. The solution
is to forcefully indent E one level:

* A
  * B
    * C
      * D
  * E
* F
* F

The magic number 4 comes as the minimum number of columns to wrap where
the output shows clearly the commits are unrelated and doesn't cause too
much "pyramid" effects

Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
graph.c
t/t4218-log-graph-indentation.sh