aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-03-12 14:44:20 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-03-12 14:44:20 -0400
commit3dc979470ed07e48c9919b14c0075c44a435cdcd (patch)
tree202741a35eac10e4df2406d3e093d968c9054369
parent20f1365ce1ec3737149a88b73101188269227968 (diff)
downloadikiwiki-3dc979470ed07e48c9919b14c0075c44a435cdcd.tar
ikiwiki-3dc979470ed07e48c9919b14c0075c44a435cdcd.tar.gz
use git show to get the diff
If a diff of the firsst commit in a git repo was requested, it would fail and print to stderr since first^ isn't valid. Using git show will always work.
-rw-r--r--IkiWiki/Rcs/git.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index 9f65e86aa..9306a513e 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -414,7 +414,16 @@ sub rcs_recentchanges ($) { #{{{
sub rcs_diff ($) { #{{{
my $rev=shift;
my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint
- return join("\n", run_or_non("git", "diff", "$sha1^", $sha1));
+ my $ret;
+ foreach my $line (run_or_non("git", "show", $sha1)) {
+ if (defined $ret) {
+ $ret.=$line."\n";
+ }
+ elsif ($line=~/^diff --git/) {
+ $ret=$line."\n";
+ }
+ }
+ return $ret;
} #}}}
sub rcs_getctime ($) { #{{{