]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Rcs/git.pm
Use bzr --quiet to avoid it outputting stuff and messing up http headers. (Scott Bronson)
[ikiwiki.git] / IkiWiki / Rcs / git.pm
index 376d03c780336f6cc4a999fc370143a0d40f8177..1882b43ef5f1c8e642b429785ca9e55af556ae48 100644 (file)
@@ -319,13 +319,6 @@ sub rcs_commit ($$$;$$) { #{{{
                    (length $message ? ": $message" : "");
        }
 
-       # XXX: Wiki directory is in the unlocked state when starting this
-       # action.  But it takes time for a Git process to finish its job
-       # (especially if a merge required), so we must re-lock to prevent
-       # race conditions.  Only when the time of the real commit action
-       # (i.e. git push) comes, we'll unlock the directory.
-       lockwiki();
-
        # Check to see if the page has been changed by someone else since
        # rcs_prepedit was called.
        my $cur    = git_sha1($file);
@@ -340,7 +333,6 @@ sub rcs_commit ($$$;$$) { #{{{
        # so we should ignore its exit status (hence run_or_non).
        $message = possibly_foolish_untaint($message);
        if (run_or_non('git', 'commit', '-q', '-m', $message, '-i', $file)) {
-               unlockwiki();
                if (length $config{gitorigin_branch}) {
                        run_or_cry('git', 'push', $config{gitorigin_branch});
                }
@@ -422,7 +414,18 @@ 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 @lines;
+       foreach my $line (run_or_non("git", "show", $sha1)) {
+               if (@lines || $line=~/^diff --git/) {
+                       push @lines, $line."\n";
+               }
+       }
+       if (wantarray) {
+               return @lines;
+       }
+       else {
+               return join("", @lines);
+       }
 } #}}}
 
 sub rcs_getctime ($) { #{{{