From e4445e9b8c6ec6cd0fb4642712d56d4a4a0f13b0 Mon Sep 17 00:00:00 2001 From: Milton Soares Filho Date: Fri, 25 Oct 2013 18:51:27 -0200 Subject: graph.c: mark root commit differently For projects with separate history lines and, thus, multiple root-commits, the linear arrangement of `git log --graph --oneline` does not allow the user to spot where the sequence ends, giving the impression that it's a contiguous history. E.g. History sequence A: a1 -- a2 -- a3 (root-commit) History sequence B: b1 -- b2 -- b3 (root-commit) git log --graph --oneline * a1 * a2 * a3 * b1 * b2 * b3 In a GUI tool, the root-commit of each series would stand out on the graph. This modification changes the commit char to a different symbol ('x'), so users of the command-line graph tool can easily identify root-commits and make sense of where each series is limited to. git log --graph --oneline * a1 * a2 x a3 * b1 * b2 x b3 Signed-off-by: Milton Soares Filho Signed-off-by: Junio C Hamano --- revision.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/revision.c b/revision.c index 0173e0148b..2734454ef1 100644 --- a/revision.c +++ b/revision.c @@ -3066,9 +3066,12 @@ char *get_revision_mark(const struct rev_info *revs, const struct commit *commit return "<"; else return ">"; - } else if (revs->graph) - return "*"; - else if (revs->cherry_mark) + } else if (revs->graph) { + if (commit->parents == NULL) + return "x"; /* diverges root-commits in subsequent series */ + else + return "*"; + } else if (revs->cherry_mark) return "+"; return ""; } -- cgit v1.2.1