X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/238e8b95a5b084e7131d3314b78419b9404cba4c..a0b55ac3cd4f840f62d0441e3b1fe9b95ec15007:/IkiWiki/Plugin/git.pm diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 996ab6fba..e89813253 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -794,8 +794,6 @@ sub git_parse_changes { die $@ if $@; my $fh; ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); - # Ensure we run this in the right place, - # see comments in rcs_receive. my $cmd = ($no_chdir ? '' : "cd $config{srcdir} && ") . "git show $detail->{sha1_to} > '$path'"; if (system($cmd) != 0) { @@ -836,26 +834,24 @@ sub rcs_receive () { return reverse @rets; } -sub rcs_preprevert (@) { - my %params = @_; - my $rev = $params{rev}; +sub rcs_preprevert ($) { + my $rev=shift; + my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint - # Note test_changes expects 'cgi' and 'session' parameters. - require IkiWiki::Receive; - IkiWiki::Receive::test_changes(%params, changes => - [git_parse_changes(git_commit_info($rev, 1))]); + return git_parse_changes(git_commit_info($sha1, 1)); } sub rcs_revert ($) { # Try to revert the given rev; returns undef on _success_. - my $rev = $shift; + my $rev = shift; + my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint - if (run_or_non('git', 'revert', '--no-commit', $rev)) { + if (run_or_non('git', 'revert', '--no-commit', $sha1)) { return undef; } else { run_or_die('git', 'reset', '--hard'); - return sprintf(gettext("Failed to revert commit %s"), $rev); + return sprintf(gettext("Failed to revert commit %s"), $sha1); } }