From 9e43b9cdf4dc7788c88afde3eb1331f18256c729 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 12 Sep 2006 18:24:12 +0200 Subject: [PATCH] Add graph_parent_is_merge --- tig.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tig.c b/tig.c index 8549620..0ec81b8 100644 --- a/tig.c +++ b/tig.c @@ -2807,6 +2807,12 @@ static struct rev_stack graph_stacks[3] = { { &graph_stacks[1], &graph_stacks[0], &graph_parents[2] }, }; +static inline bool +graph_parent_is_merge(struct rev_stack *graph) +{ + return graph->parents->size > 1; +} + static void reset_rev_graph(struct rev_stack *graph) { @@ -2856,7 +2862,7 @@ draw_rev_graph(struct rev_stack *graph) for (i = 0; i < graph->pos; i++) { append_to_rev_graph(graph, line); - if (graph->prev->parents->size > 1 && + if (graph_parent_is_merge(graph->prev) && graph->prev->pos == i) { separator = '`'; line = '.'; @@ -2878,7 +2884,7 @@ draw_rev_graph(struct rev_stack *graph) for (; i < graph->size; i++) { append_to_rev_graph(graph, separator); append_to_rev_graph(graph, line); - if (graph->prev->parents->size > 1) { + if (graph_parent_is_merge(graph->prev)) { if (i < graph->prev->pos + graph->parents->size) { separator = '`'; line = '.'; @@ -2918,7 +2924,8 @@ update_rev_graph(struct rev_stack *graph) push_rev_stack(graph->next, graph->rev[i]); draw_rev_graph(graph); - if (graph->prev->parents->size > 1 && + + if (graph_parent_is_merge(graph->prev) && graph->prev->pos < graph->prev->size - 1 && graph->size == graph->prev->size + graph->prev->parents->size - 1) { i = graph->prev->pos + graph->prev->parents->size - 1; @@ -2929,6 +2936,7 @@ update_rev_graph(struct rev_stack *graph) i++; } } + reset_rev_graph(graph->prev); } -- 2.30.2