diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-31 19:23:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-31 19:23:54 -0400 |
commit | f7b8f2297cf828ffc3b4175959e3c69fc2db93e2 (patch) | |
tree | 7ab0fe66912bef6768f4a9539781cf6161c2948d /IkiWiki | |
parent | 391c5c2cb58719ca6f7a128e23ec387276c53c62 (diff) | |
download | ikiwiki-f7b8f2297cf828ffc3b4175959e3c69fc2db93e2.tar ikiwiki-f7b8f2297cf828ffc3b4175959e3c69fc2db93e2.tar.gz |
Add test for old versions of git that don't support --cleanup=verbatim, and munge empty commit messages.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Rcs/git.pm | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm index ecf560d0b..1fa9188aa 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm @@ -336,11 +336,23 @@ sub rcs_commit_staged ($$$) { $ENV{GIT_AUTHOR_EMAIL}="$u\@web"; } + $message = 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 = 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}); } |