web commit by RecaiOktas: Revert last change in patch.

master
joey 2006-09-29 11:44:08 +00:00
parent 711d4c075e
commit 8529b9edb0
1 changed files with 20 additions and 11 deletions

View File

@ -1,32 +1,41 @@
Preliminary patch for a feature wishlist item: [[bugs/pruning_is_too_strict]]. Preliminary patch for a feature wishlist item: [[bugs/pruning_is_too_strict]].
diff --git a/IkiWiki.pm b/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm
index 1a00f2d..7381ae7 100644 index 1a00f2d..0119a26 100644
--- a/IkiWiki.pm --- a/IkiWiki.pm
+++ b/IkiWiki.pm +++ b/IkiWiki.pm
@@ -20,6 +20,7 @@ our $VERSION = 1.00; @@ -20,6 +20,8 @@ our $VERSION = 1.00;
# Optimisation. # Optimisation.
use Memoize; use Memoize;
memoize("abs2rel"); memoize("abs2rel");
+memoize("basefile");
+memoize("is_prune"); +memoize("is_prune");
memoize("pagespec_translate"); memoize("pagespec_translate");
my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
@@ -331,6 +332,14 @@ sub abs2rel ($$) { #{{{ @@ -318,6 +320,22 @@ sub baseurl (;$) { #{{{
return $ret; return $page;
} #}}} } #}}}
+sub is_prune ($;$) { #{{{ +sub basefile ($;$) { #{{{
+ my $file=shift; + my $file=shift;
+ my $base=shift || $config{srcdir}; + my $base=shift || $config{srcdir};
+ +
+ my $rel=abs2rel($file, $base); + require File::Spec;
+ return $rel eq '.' ? 0 : $rel=~m/$config{wiki_file_prune_regexp}/; + $base=File::Spec->canonpath($base);
+ my $ret=File::Spec->canonpath($file);
+
+ $ret=~s#^$base/*##;
+ return $ret;
+} #}}} +} #}}}
+ +
sub displaytime ($) { #{{{ +sub is_prune ($;$) { #{{{
my $time=shift; + return basefile($_[0], $_[1])=~m/$config{wiki_file_prune_regexp}/;
+} #}}}
+
sub abs2rel ($$) { #{{{
# Work around very innefficient behavior in File::Spec if abs2rel
# is passed two relative paths. It's much faster if paths are
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index f550b67..5d1991d 100644 index f550b67..5d1991d 100644
--- a/IkiWiki/CGI.pm --- a/IkiWiki/CGI.pm