From 90689090513fb3285b12eb0c9cda87c4125ded86 Mon Sep 17 00:00:00 2001 From: Anssi Johansson Date: Tue, 5 Jun 2018 22:20:19 +0300 Subject: [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 --- git-tools/hooks/commit-msg | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git-tools') 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; -- cgit v1.2.1