]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/git.pm
brace style and layout
[ikiwiki.git] / IkiWiki / Plugin / git.pm
index ad58231e0bbd897e0f65dec50cc1be451fa3c92a..786c7b1f246652d5d0ba73ec0f839535be5e7430 100644 (file)
@@ -419,7 +419,10 @@ sub git_sha1 (;$) {
                '--', $file);
        if ($sha1) {
                ($sha1) = $sha1 =~ m/($sha1_pattern)/; # sha1 is untainted now
-       } else { debug("Empty sha1sum for '$file'.") }
+       }
+       else {
+               debug("Empty sha1sum for '$file'.");
+       }
        return defined $sha1 ? $sha1 : q{};
 }
 
@@ -613,9 +616,15 @@ sub rcs_getctime ($) {
        # Remove srcdir prefix
        $file =~ s/^\Q$config{srcdir}\E\/?//;
 
-       my @sha1s = run_or_non('git', 'rev-list', 'HEAD', '--', $file);
-       my $ci    = git_commit_info($sha1s[$#sha1s], 1);
-       my $ctime = $ci->{'author_epoch'};
+       my @raw_lines = run_or_die('git', 'log', 
+               '--follow', '--no-merges',
+               '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
+               '-r', '--', $file);
+       my @ci;
+       while (my $parsed = parse_diff_tree("", \@raw_lines)) {
+               push @ci, $parsed;
+       }
+       my $ctime = $ci[$#ci]->{'author_epoch'};
        debug("ctime for '$file': ". localtime($ctime));
 
        return $ctime;