Skip to content

Commit

Permalink
graph: fix coloring around octopus merges
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trhd authored and gitster committed Oct 18, 2013
1 parent e45bda8 commit 339c17b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions graph.c
Expand Up @@ -801,10 +801,10 @@ static int graph_draw_octopus_merge(struct git_graph *graph,
int num_dashes =
((graph->num_parents - dashless_commits) * 2) - 1;
for (i = 0; i < num_dashes; i++) {
col_num = (i / 2) + dashless_commits;
col_num = (i / 2) + dashless_commits + graph->commit_index;
strbuf_write_column(sb, &graph->new_columns[col_num], '-');
}
col_num = (i / 2) + dashless_commits;
col_num = (i / 2) + dashless_commits + graph->commit_index;
strbuf_write_column(sb, &graph->new_columns[col_num], '.');
return num_dashes + 1;
}
Expand Down

0 comments on commit 339c17b

Please sign in to comment.