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
* b3In 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 b3UPDATE: dealing with the mark at get_revision_mark() to address Junio C Hamano concerns and give it a proper priority:
Show 13 quoted lines
> It is unclear why the update goes to this function. At the first > glance, I feel that it would be more sensible to add the equivalent > code to get_revision_mark()---we do not have to worry about what > else, other than calling get_revision_mark() and adding it to sb, > would be skipped by the added "return" when we later have to update > this function and add more code after the existing strbuf_addstr(). > > The change implemented your way will lose other information when a > root commit is at the boundary, marked as uninteresting, or on the > left/right side of traversal (when --left-right is requested). I > think these pieces of information your patch seems to be losing are > a lot more relevant than "have we hit the root?", especially in the > majority of repositories where there is only one root commit.
Signed-off-by: Milton Soares Filho <milton.soares.filho@gmail.com> --- revision.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to revision.c +3 −1
diff --git a/revision.c b/revision.c index 0173e01..ab0447f 100644 --- a/revision.c +++ b/revision.c @@ -3066,7 +3066,9 @@ char *get_revision_mark(const struct rev_info *revs, const struct commit *commit return "<"; else return ">"; - } else if (revs->graph) + } else if (revs->graph && commit->parents == NULL) + return "x"; /* diverges root-commits in subsequent series */ + else if (revs->graph) return "*"; else if (revs->cherry_mark) return "+";
-- 1.8.1.2