aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/git.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-11 22:38:42 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-11 22:38:42 -0400
commit33f42db2ea0422551223c255d85d9f4e45ee404b (patch)
tree26a8364295b181cbfd97dd1d07f70ac836c444ac /IkiWiki/Plugin/git.pm
parent99eec4f03de310b544ae727b3b28f14271ef3e30 (diff)
downloadikiwiki-33f42db2ea0422551223c255d85d9f4e45ee404b.tar
ikiwiki-33f42db2ea0422551223c255d85d9f4e45ee404b.tar.gz
git: --getctime will now follow renames back to the original creation of a file.
This will be a bit more expensive, but --getctime does not need to be fast. And getting the real creation time a very useful when untangling blog histories that involve renames.
Diffstat (limited to 'IkiWiki/Plugin/git.pm')
-rw-r--r--IkiWiki/Plugin/git.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index ad58231e0..e10283f59 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -613,9 +613,11 @@ 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', '--reverse', '--follow',
+ '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
+ '-r', '--', $file);
+ my $first = parse_diff_tree("", \@raw_lines);
+ my $ctime = $first->{'author_epoch'};
debug("ctime for '$file': ". localtime($ctime));
return $ctime;