1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 22:28:46 +01:00

[ticket/9824] Handle empty commit messages in commit-msg hook.

Git already handles the case of commit message being empty by
aborting the commit and displaying a reasonably helpful message.
If there is no commit message, the hook will exit with success
exit code to let git do its thing.

PHPBB3-9824
This commit is contained in:
Oleg Pudeyev 2011-03-01 20:17:59 -05:00
parent 9bed2b119c
commit c489b189df

View File

@ -55,6 +55,17 @@ quit()
fi
}
# Check for empty commit message
if ! grep -qv '^#' "$1"
then
# Commit message is empty (or contains only comments).
# Let git handle this.
# It will abort with a message like so:
#
# Aborting commit due to empty commit message.
exit 0
fi
msg=$(grep -nE '.{81,}' "$1");
if [ $? -eq 0 ]