path: root/graph.c
diff options
authorJohn Keeping <>2013-02-07 20:15:23 (GMT)
committerJunio C Hamano <>2013-02-07 20:54:26 (GMT)
commita48ec2415882ae15b8593185d6f9ab2f69555a9d (patch)
treeadaf41c2629490ecc1cc4d689cce755c3dbfff40 /graph.c
parent42f50f8d0150605ab4da32d283cef2df0bcb51ab (diff)
graph: output padding for merge subsequent parents
When showing merges in git-log, the same commit is shown once for each parent. Combined with "--graph" this results in graph_show_commit() being called once for each parent without graph_update() being called. Currently graph_show_commit() does not print anything on subsequent invocations for the same commit (this was changed by commit 656197a - "graph.c: infinite loop in git whatchanged --graph -m" from the previous behaviour of looping infinitely). Change this so that if the graph code believes it has already shown the commit it prints a single padding line. Signed-off-by: John Keeping <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'graph.c')
1 files changed, 10 insertions, 0 deletions
diff --git a/graph.c b/graph.c
index 391a712..2a3fc5c 100644
--- a/graph.c
+++ b/graph.c
@@ -1227,6 +1227,16 @@ void graph_show_commit(struct git_graph *graph)
if (!graph)
+ /*
+ * When showing a diff of a merge against each of its parents, we
+ * are called once for each parent without graph_update having been
+ * called. In this case, simply output a single padding line.
+ */
+ if (graph_is_commit_finished(graph)) {
+ graph_show_padding(graph);
+ shown_commit_line = 1;
+ }
while (!shown_commit_line && !graph_is_commit_finished(graph)) {
shown_commit_line = graph_next_line(graph, &msgbuf);
fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);