Skip to content

Commit a48ec24

Browse files
johnkeepinggitster
authored andcommitted
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 <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 42f50f8 commit a48ec24

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

graph.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,16 @@ void graph_show_commit(struct git_graph *graph)
12271227
if (!graph)
12281228
return;
12291229

1230+
/*
1231+
* When showing a diff of a merge against each of its parents, we
1232+
* are called once for each parent without graph_update having been
1233+
* called. In this case, simply output a single padding line.
1234+
*/
1235+
if (graph_is_commit_finished(graph)) {
1236+
graph_show_padding(graph);
1237+
shown_commit_line = 1;
1238+
}
1239+
12301240
while (!shown_commit_line && !graph_is_commit_finished(graph)) {
12311241
shown_commit_line = graph_next_line(graph, &msgbuf);
12321242
fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);

0 commit comments

Comments
 (0)