aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-29 15:51:25 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-29 15:51:25 -0400
commitf0090d8c5781682eb0e4a59cb92438c0b7baafa1 (patch)
tree71fcdf46e52020ad0374142a03ec781aae2b9da5
parent64def3eaeae4ddbe5cee61d08612da1eb1bc54d3 (diff)
downloadikiwiki-f0090d8c5781682eb0e4a59cb92438c0b7baafa1.tar
ikiwiki-f0090d8c5781682eb0e4a59cb92438c0b7baafa1.tar.gz
check generated pages in
I considered not checking them in, or making the checkin configurable. However, then they would remain not checked in if edited by a user, which is probably not desired. Note that passing undef as the username/ip to rcs_commit_staged may not result in ideal behavior; the commit may seem to come from "anonymous" with some revision control systems. Most of them handle it a bit better and just have it come from whatever user is running the build.
-rw-r--r--IkiWiki/Plugin/autoindex.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm
index 0a8d90701..8179ee1e7 100644
--- a/IkiWiki/Plugin/autoindex.pm
+++ b/IkiWiki/Plugin/autoindex.pm
@@ -16,6 +16,9 @@ sub genindex ($) { #{{{
my $template=template("autoindex.tmpl");
$template->param(page => $page);
writefile($file, $config{srcdir}, $template->output);
+ if ($config{rcs}) {
+ IkiWiki::rcs_add($file);
+ }
} #}}}
sub refresh () { #{{{
@@ -45,9 +48,23 @@ sub refresh () { #{{{
}
}, $config{srcdir});
+ my @needed;
foreach my $dir (keys %dirs) {
if (! exists $pages{$dir}) {
- genindex($dir);
+ push @needed, $dir;
+ }
+ }
+
+ if (@needed) {
+ if ($config{rcs}) {
+ IkiWiki::disable_commit_hook();
+ }
+ genindex($_) foreach @needed;
+ if ($config{rcs}) {
+ IkiWiki::rcs_commit_staged(
+ gettext("automatic index generation"),
+ undef, undef);
+ IkiWiki::enable_commit_hook();
}
}
} #}}}