graph: fix coloring around octopus merges
When drawing the graph of an octopus merge, we draw a horizontal line from parents 3 and above into the asterisk representing the commit. The sections of this line should be colored to match the graph lines coming in from above. However, if the commit is not in the left-most column we do not take into account the columns to the left of the commit when calculating these colors. Fix this by adding the appropriate offset to the column index used for calculating the color. Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Hemmo Nieminen committed
Oct 16, 2013 at 11:28 UTC
339c17bc7690b5436ac61c996cede3d52c85b50d
1 file changed
+2
-2
graph.c
+2
-2
@@ -801,10 +801,10 @@ static int graph_draw_octopus_merge(struct git_graph *graph,
801
int num_dashes =
802
((graph->num_parents - dashless_commits) * 2) - 1;
803
for (i = 0; i < num_dashes; i++) {
804
- col_num = (i / 2) + dashless_commits;
804
+ col_num = (i / 2) + dashless_commits + graph->commit_index;
805
strbuf_write_column(sb, &graph->new_columns[col_num], '-');
806
}
807
- col_num = (i / 2) + dashless_commits;
807
+ col_num = (i / 2) + dashless_commits + graph->commit_index;
808
strbuf_write_column(sb, &graph->new_columns[col_num], '.');
809
return num_dashes + 1;
810
}