From: Jonas Fonseca Date: Sat, 16 Sep 2006 12:12:41 +0000 (+0200) Subject: push_rev_graph: iterate all graph revs when looking for duplicates X-Git-Tag: tig-0.6~5 X-Git-Url: https://git.distorted.org.uk/~mdw/tig/commitdiff_plain/2fe894e6391aeb6124902a5030dc2776877824fc?hp=-c push_rev_graph: iterate all graph revs when looking for duplicates Now atleast there will not be unconnected lines at the end of the graph. --- 2fe894e6391aeb6124902a5030dc2776877824fc diff --git a/tig.c b/tig.c index 4e06fa5..1e033c6 100644 --- 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);