]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/git.pm
add plugin safe/rebuild info (part 1 of 2)
[ikiwiki.git] / IkiWiki / Plugin / git.pm
index 5e302729ea1c26c80c93d4974e94e8a57e444012..36674572b6ae3d83426d79b56d7b26394dd41462 100644 (file)
@@ -42,10 +42,14 @@ sub checkconfig () { #{{{
 
 sub getsetup () { #{{{
        return
+               plugin => {
+                       safe => 0, # rcs plugin
+                       rebuild => undef,
+               },
                git_wrapper => {
                        type => "string",
                        example => "/git/wiki.git/hooks/post-update",
-                       description => "git post-update executable to generate",
+                       description => "git post-update hook to generate",
                        safe => 0, # file
                        rebuild => 0,
                },
@@ -411,11 +415,23 @@ sub rcs_commit_staged ($$$) {
                $ENV{GIT_AUTHOR_EMAIL}="$u\@web";
        }
 
+       $message = IkiWiki::possibly_foolish_untaint($message);
+       my @opts;
+       if ($message !~ /\S/) {
+               # Force git to allow empty commit messages.
+               # (If this version of git supports it.)
+               my ($version)=`git --version` =~ /git version (.*)/;
+               if ($version ge "1.5.4") {
+                       push @opts, '--cleanup=verbatim';
+               }
+               else {
+                       $message.=".";
+               }
+       }
+       push @opts, '-q';
        # git commit returns non-zero if file has not been really changed.
        # so we should ignore its exit status (hence run_or_non).
-       $message = IkiWiki::possibly_foolish_untaint($message);
-       if (run_or_non('git', 'commit', '--cleanup=verbatim',
-                      '-q', '-m', $message)) {
+       if (run_or_non('git', 'commit', @opts, '-m', $message)) {
                if (length $config{gitorigin_branch}) {
                        run_or_cry('git', 'push', $config{gitorigin_branch});
                }