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.
master
Joey Hess 2010-04-22 00:12:15 -04:00
parent bc6d602609
commit 2b175d7c1f
2 changed files with 18 additions and 2 deletions

View File

@ -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';

View File

@ -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!