Add test for old versions of git that don't support --cleanup=verbatim, and munge empty commit messages.

master
Joey Hess 2008-07-31 19:23:54 -04:00
parent 391c5c2cb5
commit f7b8f2297c
2 changed files with 17 additions and 3 deletions

View File

@ -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});
}

2
debian/changelog vendored
View File

@ -6,6 +6,8 @@ ikiwiki (2.56) UNRELEASED; urgency=low
treating it as XHTML. This avoids problems with escaping the end of the
CDATA when the htmlscrubber is not used, and it avoids problems with atom
XHTML using named entity references that are not in the atom DTD. (Simon McVittie)
* Add test for old versions of git that don't support --cleanup=verbatim,
and munge empty commit messages.
-- Joey Hess <joeyh@debian.org> Tue, 29 Jul 2008 15:53:26 -0400