summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-11-18 19:59:40 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-11-18 21:25:56 +0100
commitb332f4cf3b2b49f2d170215cbd757c42f7e5dd98 (patch)
tree50dbdac458226b6ba15a4496780859ae0b37fddd
parent98d287520b2c1333a0e0d128dc1afad90908a785 (diff)
downloadqtrepotools-b332f4cf3b2b49f2d170215cbd757c42f7e5dd98.tar.gz
less ugly merge detection in log message
(cherry picked from commit d326a1cc11c5c3bed3733db85a1f52b20fee093e)
-rwxr-xr-xgit-hooks/sanitize-commit8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index c931994..750248b 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -78,10 +78,14 @@ my $ln = 0;
my $iswip = defined($cfg{wip});
my $revok = defined($cfg{revby});
my $badlog = defined($cfg{log});
+my $parents = 0;
open MSG, "git log -1 --pretty=raw ".$sha1." |" or die "cannot run git: $!";
while (<MSG>) {
chomp;
- s/^ // or next;
+ if (!s/^ //) {
+ $parents++ if (/^parent /);
+ next
+ }
if ($ln == 0) {
$summary = $_;
if (!$iswip && /\bWIP\b|\*{3}|^(?:squash|fixup)! |^(.)\1*$/i) {
@@ -92,7 +96,7 @@ while (<MSG>) {
} elsif (!$badlog && length($_) > 120) {
&complain("Log message summary is excessively long", "log");
$badlog = 1;
- } elsif (length($_) > 70 && !/^Merge ((remote )?branch '[^ ]+'|branch '[^ ]+' of [^ ]+( into [^ ]+)?)$/) {
+ } elsif ($parents < 2 && length($_) > 70) {
&complain("Aim for shorter log message summaries", "", -1);
}
} elsif ($ln == 1) {