From: Joey Hess <joey@gnu.kitenet.net>
Date: Mon, 12 Oct 2009 03:07:31 +0000 (-0400)
Subject: can't use --reverse with git log --follow
X-Git-Tag: 3.20091017~27^2~16
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/bf577d34c79ebe48efdf06ed826f9109e196cc6d?ds=inline;hp=-c

can't use --reverse with git log --follow

Meh, git.
---

bf577d34c79ebe48efdf06ed826f9109e196cc6d
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index e10283f59..9ecda4ffb 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -613,11 +613,14 @@ sub rcs_getctime ($) {
 	# Remove srcdir prefix
 	$file =~ s/^\Q$config{srcdir}\E\/?//;
 
-	my @raw_lines = run_or_die('git', 'log', '--reverse', '--follow',
+	my @raw_lines = run_or_die('git', 'log', '--follow',
 		'--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
 		'-r', '--', $file);
-	my $first = parse_diff_tree("", \@raw_lines);
-	my $ctime = $first->{'author_epoch'};
+	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;