summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilton Soares Filho <milton.soares.filho@gmail.com>2013-10-25 18:51:27 -0200
committerJunio C Hamano <gitster@pobox.com>2013-10-25 14:57:33 -0700
commite4445e9b8c6ec6cd0fb4642712d56d4a4a0f13b0 (patch)
treeb8eccf6b787b942b8bf7ddac5f5009ca950d9d0f
parent3d092bfc6f2d9a998967979f926c661e9762601c (diff)
downloadgit-mf/graph-show-root.tar.gz
graph.c: mark root commit differentlymf/graph-show-root
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 <milton.soares.filho@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--revision.c9
1 files 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 "";
}