ah, the joys of test-based development..
[ikiwiki.git] / IkiWiki / Render.pm
index 35e279a68232c7b0a6e6fb353d3af448cd35df94..be6e6d1cbe8b5e09b0c5e626bb6d8c44023e7519 100644 (file)
@@ -158,10 +158,31 @@ sub add_depends ($$) { #{{{
                $depends{$page}=$globlist;
        }
        else {
-               $depends{$page}.=" ".$globlist;
+               $depends{$page}=globlist_merge($depends{$page}, $globlist);
        }
 } # }}}
 
+sub globlist_merge ($$) { #{{{
+       my $a=shift;
+       my $b=shift;
+
+       my $ret="";
+       # Only add negated globs if they are not matched by the other globlist.
+       foreach my $i ((map { [ $a, $_ ] } split(" ", $b)), 
+                      (map { [ $b, $_ ] } split(" ", $a))) {
+               if ($i->[1]=~/^!(.*)/) {
+                       if (! globlist_match($1, $i->[0])) {
+                               $ret.=" ".$i->[1];
+                       }
+               }
+               else {
+                       $ret.=" ".$i->[1];
+               }
+       }
+       
+       return $ret;
+} #}}}
+
 sub genpage ($$$) { #{{{
        my $content=shift;
        my $page=shift;