aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-22 00:12:15 -0400
committerJoey Hess <joey@kitenet.net>2010-04-22 00:18:20 -0400
commit2b175d7c1fe997277800c0d501332e96de475c6d (patch)
treee022416ed318e339e5ce5b39f9f4037e71afdd14
parentbc6d6026093ae6f2bfd72a2c06887358a0e59b6b (diff)
downloadikiwiki-2b175d7c1fe997277800c0d501332e96de475c6d.tar
ikiwiki-2b175d7c1fe997277800c0d501332e96de475c6d.tar.gz
improved fix for depends_simple_mixup
Avoid adding the page matched against as an influence for currently failing pagespec matches, while still adding any other influences. This avoids bloating depends_simple with lots of bogus influences when matching eg, "!link(done)". It's only necessary for the page being tested to be an influence of that if the page matches.
-rw-r--r--IkiWiki.pm14
-rw-r--r--doc/bugs/depends_simple_mixup.mdwn6
2 files changed, 18 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 0791e1e75..509f9ba2e 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1818,10 +1818,12 @@ sub add_depends ($$;$) {
foreach my $p (keys %pagesources) {
my $r=$sub->($p, location => $page);
my $i=$r->influences;
+ my $static=$r->influences_static;
foreach my $k (keys %$i) {
+ next unless $r || $static || $k eq $page;
$depends_simple{$page}{lc $k} |= $i->{$k};
}
- last if $r->influences_static;
+ last if $static;
}
$depends{$page}{$pagespec} |= $deptype;
@@ -2136,6 +2138,9 @@ sub pagespec_match_list ($$;@) {
my $r=$sub->($p, %params, location => $page);
error(sprintf(gettext("cannot match pages: %s"), $r))
if $r->isa("IkiWiki::ErrorReason");
+ unless ($r) {
+ $r->remove_influence($p);
+ }
$accum |= $r;
if ($r) {
push @matches, $p;
@@ -2232,6 +2237,13 @@ sub merge_influences {
}
}
+sub remove_influence {
+ my $this=shift;
+ my $torm=shift;
+
+ delete $this->[1]{$torm};
+}
+
package IkiWiki::ErrorReason;
our @ISA = 'IkiWiki::FailReason';
diff --git a/doc/bugs/depends_simple_mixup.mdwn b/doc/bugs/depends_simple_mixup.mdwn
index 79bfa8bdc..a5910d02e 100644
--- a/doc/bugs/depends_simple_mixup.mdwn
+++ b/doc/bugs/depends_simple_mixup.mdwn
@@ -81,4 +81,8 @@ non-$page influences.
Hmm, commit f2b3d1341447cbf29189ab490daae418fbe5d02d seems
thuroughly wrong. So, what about influence info for other matches
like `!author(foo)` etc? Currently, none is returned, but it should
-be a content influence. (Backlink influence data is ok.)
+be a content influence. (Backlink influence data seems ok.)
+
+----
+
+[[done]] again!