git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] graph.c: visual difference on subsequent series
@ 2013-10-25 16:07 Milton Soares Filho
  2013-10-25 17:13 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Milton Soares Filho @ 2013-10-25 16:07 UTC (permalink / raw)
  To: git; +Cc: Milton Soares Filho

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>
---
 graph.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/graph.c b/graph.c
index b24d04c..ec8e960 100644
--- a/graph.c
+++ b/graph.c
@@ -780,6 +780,15 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)
 	}
 
 	/*
+	 * Out-stand parentless commits to enforce non-continuity on subsequent
+	 * but separate series
+	 */
+	if (graph->commit->parents == NULL) {
+		strbuf_addch(sb, 'x');
+		return;
+	}
+
+	/*
 	 * get_revision_mark() handles all other cases without assert()
 	 */
 	strbuf_addstr(sb, get_revision_mark(graph->revs, graph->commit));
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-03 20:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 16:07 [PATCH] graph.c: visual difference on subsequent series Milton Soares Filho
2013-10-25 17:13 ` Junio C Hamano
2013-10-25 20:49   ` Milton Soares Filho
2013-10-26  2:37     ` Keshav Kini
2013-10-28 15:41       ` Junio C Hamano
2013-10-28 16:59         ` Keshav Kini
2013-10-28 17:18         ` Milton Soares Filho
2013-10-28 17:39           ` Junio C Hamano
2013-12-20 20:22             ` [RFH/PATCH] graph: give an extra gap after showing root commit Junio C Hamano
2013-12-20 22:03               ` Junio C Hamano
2014-01-03 20:16               ` Thomas Rast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).