]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Render.pm
fix false positive in link_types_changed
[git.ikiwiki.info.git] / IkiWiki / Render.pm
index e98888d76ecd17709e054b3a7068e0c439341a8a..0e5336f22e83cdd998f95a1aa5038aad03e20528 100644 (file)
@@ -352,6 +352,8 @@ sub find_new_files ($) {
        my @new;
        my @internal_new;
 
+       my $times_noted;
+
        foreach my $file (@$files) {
                my $page=pagename($file);
                if (exists $pagesources{$page} && $pagesources{$page} ne $file) {
@@ -363,16 +365,33 @@ sub find_new_files ($) {
                        if (isinternal($page)) {
                                push @internal_new, $file;
                        }
-                       else {
+                       elsif ($config{rcs}) {
                                push @new, $file;
-                               if ($config{getctime} && -e "$config{srcdir}/$file") {
+                               if ($config{gettime} && -e "$config{srcdir}/$file") {
+                                       if (! $times_noted) {
+                                               debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs}));
+                                               $times_noted=1;
+                                       }
+
                                        eval {
-                                               my $time=rcs_getctime("$config{srcdir}/$file");
-                                               $pagectime{$page}=$time;
+                                               my $ctime=rcs_getctime("$config{srcdir}/$file");
+                                               if ($ctime > 0) {
+                                                       $pagectime{$page}=$ctime;
+                                               }
                                        };
                                        if ($@) {
                                                print STDERR $@;
                                        }
+                                       my $mtime;
+                                       eval {
+                                               $mtime=rcs_getmtime("$config{srcdir}/$file");
+                                       };
+                                       if ($@) {
+                                               print STDERR $@;
+                                       }
+                                       elsif ($mtime > 0) {
+                                               utime($mtime, $mtime, "$config{srcdir}/$file");
+                                       }
                                }
                        }
                        $pagecase{lc $page}=$page;
@@ -412,7 +431,7 @@ sub remove_del (@) {
        foreach my $file (@_) {
                my $page=pagename($file);
                if (! isinternal($page)) {
-                       debug(sprintf(gettext("removing old page %s"), $page));
+                       debug(sprintf(gettext("removing obsolete %s"), $page));
                }
        
                foreach my $old (@{$oldrenderedfiles{$page}}) {
@@ -507,7 +526,7 @@ sub link_types_changed ($$) {
        my $old = shift;
 
        return 0 if !defined $new && !defined $old;
-       return 1 if !defined $new || !defined $old;
+       return 1 if (!defined $new && %$old) || (!defined $old && %$new);
 
        while (my ($type, $links) = each %$new) {
                foreach my $link (keys %$links) {
@@ -615,34 +634,35 @@ sub render_dependent ($$$$$$$) {
                                                        if ($type == $IkiWiki::DEPEND_LINKS) {
                                                                next unless $linkchangers->{lc($page)};
                                                        }
-                                                       return $page;
+                                                       $reason=$page;
+                                                       return 1;
                                                }
                                        }
                                        return undef;
                                };
 
                                if ($depends{$p}{$dep} & $IkiWiki::DEPEND_CONTENT) {
-                                       last if $reason =
-                                               $in->(\@changed, $IkiWiki::DEPEND_CONTENT);
-                                       last if $internal_dep && ($reason =
+                                       last if $in->(\@changed, $IkiWiki::DEPEND_CONTENT);
+                                       last if $internal_dep && (
                                                $in->($internal_new, $IkiWiki::DEPEND_CONTENT) ||
                                                $in->($internal_del, $IkiWiki::DEPEND_CONTENT) ||
-                                               $in->($internal_changed, $IkiWiki::DEPEND_CONTENT));
+                                               $in->($internal_changed, $IkiWiki::DEPEND_CONTENT)
+                                       );
                                }
                                if ($depends{$p}{$dep} & $IkiWiki::DEPEND_PRESENCE) {
-                                       last if $reason = 
-                                               $in->(\@exists_changed, $IkiWiki::DEPEND_PRESENCE);
-                                       last if $internal_dep && ($reason =
+                                       last if $in->(\@exists_changed, $IkiWiki::DEPEND_PRESENCE);
+                                       last if $internal_dep && (
                                                $in->($internal_new, $IkiWiki::DEPEND_PRESENCE) ||
-                                               $in->($internal_del, $IkiWiki::DEPEND_PRESENCE));
+                                               $in->($internal_del, $IkiWiki::DEPEND_PRESENCE)
+                                       );
                                }
                                if ($depends{$p}{$dep} & $IkiWiki::DEPEND_LINKS) {
-                                       last if $reason =
-                                               $in->(\@changed, $IkiWiki::DEPEND_LINKS);
-                                       last if $internal_dep && ($reason =
+                                       last if $in->(\@changed, $IkiWiki::DEPEND_LINKS);
+                                       last if $internal_dep && (
                                                $in->($internal_new, $IkiWiki::DEPEND_LINKS) ||
                                                $in->($internal_del, $IkiWiki::DEPEND_LINKS) ||
-                                               $in->($internal_changed, $IkiWiki::DEPEND_LINKS));
+                                               $in->($internal_changed, $IkiWiki::DEPEND_LINKS)
+                                       );
                                }
                        }
                }