summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-08-16 02:06:13 +0000
committeredef <edef@unfathomable.blue>2022-08-16 02:09:58 +0000
commit339435e0d7f5d59aef2395921cb50be302316ffb (patch)
tree48b6e2702de51583f5f3971c86b88764d32f83eb
parent619a33cc77f508b75e713bd4e12e58c16ca1267b (diff)
githooks/commit-msg: don't rely on GNU sed's Q command HEAD trunk
Not using the GNU extension makes this work on macOS.

Change-Id: I303034814a5f6a94d43522f35c4bf527282622de
-rwxr-xr-xgithooks/commit-msg2
1 files changed, 1 insertions, 1 deletions
diff --git a/githooks/commit-msg b/githooks/commit-msg
index 985819c..2279462 100755
--- a/githooks/commit-msg
+++ b/githooks/commit-msg
@@ -6,7 +6,7 @@ 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
+if [ $(< "$1" sed -ne "/^# ${cut_line}$/q;p" | git stripspace --strip-comments | wc -c) -eq 0 ]; then
     # don't inhibit "Aborting commit due to empty commit message"
     exit 0
 fi