aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Johansson <github@miuku.net>2018-06-05 22:20:19 +0300
committerAnssi Johansson <github@miuku.net>2018-06-05 22:20:19 +0300
commit90689090513fb3285b12eb0c9cda87c4125ded86 (patch)
treed000a6c2d919fcf15a010fdb651ffb2d7b7d5654 /git-tools
parentMerge branch 'prep-release-3.2.3' into 3.2.x (diff)
downloadphpbb-90689090513fb3285b12eb0c9cda87c4125ded86.tar.gz
phpbb-90689090513fb3285b12eb0c9cda87c4125ded86.tar.bz2
phpbb-90689090513fb3285b12eb0c9cda87c4125ded86.zip
[ticket/15683] Better error message when commit message has CRLF
When someone tries to do a pull request with incorrect line breaks in the commit message, the error message as given by Travis is "Unexpected EOF encountered". The error message should be clearer that CR/LF was the problem. This change adds a separate check for CRLF line endings. PHPBB3-15683
Diffstat (limited to 'git-tools')
-rwxr-xr-xgit-tools/hooks/commit-msg9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
index 136606252c..b73005b34d 100755
--- a/git-tools/hooks/commit-msg
+++ b/git-tools/hooks/commit-msg
@@ -147,6 +147,15 @@ then
quit $ERR_LENGTH;
fi
+# Check for CR/LF line breaks
+if grep -q $'\r$' "$1"
+then
+ complain "The commit message uses CR/LF line breaks, which are not permitted." >&2
+ complain >&2
+
+ quit $ERR_EOF;
+fi
+
lines=$(wc -l "$1" | awk '{ print $1; }');
expecting=header;
in_description=0;