X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/6c8a8dd13b96f2990f58596c7ec5e7c497b39cbe..0c3291d4f32efd1ccfcfca86429db67e7b1a0c35:/IkiWiki/Plugin/git.pm diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 6f0ac56d5..36674572b 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -11,9 +11,6 @@ my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "git", call => \&checkconfig); hook(type => "getsetup", id => "git", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -45,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, }, @@ -414,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}); }