+ if (! exists $pages{$dir} && ! $deleted{$dir} &&
+ grep /^$dir\/.*/, keys %pages) {
+ if (exists $IkiWiki::pagemtime{$dir}) {
+ # This page must have just been deleted, so
+ # don't re-add it. And remember it was
+ # deleted.
+ if (! ref $pagestate{index}{autoindex}{deleted}) {
+ $pagestate{index}{autoindex}{deleted}={};
+ }
+ ${$pagestate{index}{autoindex}{deleted}}{$dir}=1;
+ }
+ else {
+ push @needed, $dir;
+ }
+ }
+ }
+
+ if (@needed) {
+ if ($config{rcs}) {
+ IkiWiki::disable_commit_hook();
+ }
+ foreach my $page (@needed) {
+ genindex($page);
+ }
+ if ($config{rcs}) {
+ IkiWiki::rcs_commit_staged(
+ gettext("automatic index generation"),
+ undef, undef);
+ IkiWiki::enable_commit_hook();