+ 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 $wikistate{autoindex}{deleted}) {
+ $wikistate{autoindex}{deleted}={};
+ }
+ ${$wikistate{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(
+ message => gettext("automatic index generation"),
+ );
+ IkiWiki::enable_commit_hook();