summary refs log tree commit diff
path: root/githooks/commit-msg
diff options
context:
space:
mode:
Diffstat (limited to 'githooks/commit-msg')
-rwxr-xr-xgithooks/commit-msg6
1 files changed, 6 insertions, 0 deletions
diff --git a/githooks/commit-msg b/githooks/commit-msg
index d241f2b..c4c7736 100755
--- a/githooks/commit-msg
+++ b/githooks/commit-msg
@@ -2,6 +2,12 @@
 set -euo pipefail
 change_id=$(head -c32 /dev/urandom | git hash-object --stdin)
 
+cut_line='------------------------ >8 ------------------------'
+if [ $(< "$1" sed -e "/^# ${cut_line}$/Q" | git stripspace --strip-comments | wc -c) -eq 0 ]; then
+    # don't inhibit "Aborting commit due to empty commit message"
+    exit 0
+fi
+
 git interpret-trailers \
     --if-exists doNothing \
     --trailer "Change-Id:I$change_id" \