Code

push_rev_graph: iterate all graph revs when looking for duplicates
authorJonas Fonseca <fonseca@diku.dk>
Sat, 16 Sep 2006 12:12:41 +0000 (14:12 +0200)
committerJonas Fonseca <fonseca@antimatter.localdomain>
Sat, 16 Sep 2006 12:13:42 +0000 (14:13 +0200)
Now atleast there will not be unconnected lines at the end of the graph.

tig.c

diff --git a/tig.c b/tig.c
index 4e06fa52c5030f3e6f297b501593a2b353f7bbdd..1e033c607d041bbec20f272598dca9a6f4d6ef15 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2758,10 +2758,15 @@ done_rev_graph(struct rev_graph *graph)
 static void
 push_rev_graph(struct rev_graph *graph, char *parent)
 {
-       /* Combine duplicate parents lines. */
-       if (graph->size > 0 &&
-           !strncmp(graph->rev[graph->size - 1], parent, SIZEOF_REV))
-               return;
+       int i;
+
+       /* "Collapse" duplicate parents lines.
+        *
+        * FIXME: This needs to also update update the drawn graph but
+        * for now it just serves as a method for pruning graph lines. */
+       for (i = 0; i < graph->size; i++)
+               if (!strncmp(graph->rev[i], parent, SIZEOF_REV))
+                       return;
 
        if (graph->size < SIZEOF_REVITEMS) {
                string_ncopy(graph->rev[graph->size++], parent, SIZEOF_REV);