aboutsummaryrefslogtreecommitdiffstats
path: root/git-tools/hooks/commit-msg
diff options
context:
space:
mode:
Diffstat (limited to 'git-tools/hooks/commit-msg')
-rwxr-xr-xgit-tools/hooks/commit-msg11
1 files changed, 11 insertions, 0 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
index a6777ff9c9..1d33995162 100755
--- a/git-tools/hooks/commit-msg
+++ b/git-tools/hooks/commit-msg
@@ -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 ]