Re: [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 3, 2026, 05:04 UTC
- Message-ID
- <xmqqpl4gocrj.fsf@gitster.g>
- In-Reply-To
- <20260402211717.3604688-1-pabloosabaterr@gmail.com>
Pablo Sabater <pabloosabaterr@gmail.com> writes:
> This issue was reported by Junio at: > https://lore.kernel.org/git/xmqqikaawrpx.fsf@gitster.g/
You are giving me too much credit. I just knew about previous attempts and the gotchas.
One thing that we may want to make sure your solution gets right is the issue depicated in two graphs in the footnote of this message:
https://lore.kernel.org/git/xmqqwnwajbuj.fsf@gitster.c.googlers.com/
Stepping back a bit, I think concentrating too much on "is it
root?" is a wrong way to think about the problem. Suppose you
have two histories, e.g. (time flows from left to right; A and X
are roots) A---B
\
X---Y---Z and doing "git log --graph --oneline Z" would show A, B, X, Y
and Z.But in a slightly modified graph:
C
/
O---A---B
\
X---Y---Z if you do "git log --graph --oneline C..Z", you should see the
same commits listed as above (A, B, X, Y and Z), and most likely
in the same order.The way we draw A and make sure one raw below A in the same lane is vacant (to avoid something that is not an ancestor of A steals that spot) is applicable to both graphs. The reason why we try to keep one row below A vacant is not because it is a root, but because in the graph being drawn, none of A's parent will appear. Obviously if A is root, none of A's parent will appear in the graph, but in the latter topology where we are drawing C..Z, none of A's parent will appear not because A is root, but because all the parents of A is excluded.