Code

Move stuff to reset_rev_graph and rename it to done_rev_graph
authorJonas Fonseca <fonseca@diku.dk>
Tue, 12 Sep 2006 16:31:46 +0000 (18:31 +0200)
committerJonas Fonseca <fonseca@antimatter.localdomain>
Tue, 12 Sep 2006 16:31:46 +0000 (18:31 +0200)
tig.c

diff --git a/tig.c b/tig.c
index cc3dc50fbd2609a2e676d0b9bd5aacc2b2f67727..d1d63da05b3b6c30449ec54058d97d1d0fdf7652 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2813,14 +2813,6 @@ graph_parent_is_merge(struct rev_stack *graph)
        return graph->parents->size > 1;
 }
 
-static void
-reset_rev_graph(struct rev_stack *graph)
-{
-       graph->size = graph->pos = 0;
-       graph->commit = NULL;
-       memset(graph->parents, 0, sizeof(*graph->parents));
-}
-
 static inline void
 append_to_rev_graph(struct rev_stack *stack, chtype symbol)
 {
@@ -2828,6 +2820,27 @@ append_to_rev_graph(struct rev_stack *stack, chtype symbol)
                stack->commit->graph[stack->commit->graph_size++] = symbol;
 }
 
+static void
+done_rev_graph(struct rev_stack *graph)
+{
+       if (graph_parent_is_merge(graph) &&
+           graph->pos < graph->size - 1 &&
+           graph->next->size == graph->size + graph->parents->size - 1) {
+               size_t i = graph->pos + graph->parents->size - 1;
+
+               graph->commit->graph_size = i * 2;
+               while (i < graph->next->size - 1) {
+                       append_to_rev_graph(graph, ' ');
+                       append_to_rev_graph(graph, '\\');
+                       i++;
+               }
+       }
+
+       graph->size = graph->pos = 0;
+       graph->commit = NULL;
+       memset(graph->parents, 0, sizeof(*graph->parents));
+}
+
 static void
 push_rev_stack(struct rev_stack *stack, char *parent)
 {
@@ -2924,22 +2937,7 @@ update_rev_graph(struct rev_stack *graph)
                push_rev_stack(graph->next, graph->rev[i]);
 
        draw_rev_graph(graph);
-
-       graph = graph->prev;
-
-       if (graph_parent_is_merge(graph) &&
-           graph->pos < graph->size - 1 &&
-           graph->next->size == graph->size + graph->parents->size - 1) {
-               i = graph->pos + graph->parents->size - 1;
-               graph->commit->graph_size = i * 2;
-               while (i < graph->next->size - 1) {
-                       append_to_rev_graph(graph, ' ');
-                       append_to_rev_graph(graph, '\\');
-                       i++;
-               }
-       }
-
-       reset_rev_graph(graph);
+       done_rev_graph(graph->prev);
 }
 
 /* Reads git log --pretty=raw output and parses it into the commit struct. */