X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9ef4b5e677919f95dd2aa08ca51a0313c6c5542d..ab89494797ef6e0045428d63251287bbc05fa63b:/IkiWiki/Plugin/git.pm?ds=inline

diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index ad58231e0..b02f4a5ed 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -51,6 +51,9 @@ sub checkconfig () {
 			wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"),
 		};
 	}
+
+	# Avoid notes, parser does not handle and they only slow things down.
+	$ENV{GIT_NOTES_REF}="";
 	
 	# Run receive test only if being called by the wrapper, and not
 	# when generating same.
@@ -65,6 +68,7 @@ sub getsetup () {
 		plugin => {
 			safe => 0, # rcs plugin
 			rebuild => undef,
+			section => "rcs",
 		},
 		git_wrapper => {
 			type => "string",
@@ -419,7 +423,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 +620,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;