From 339435e0d7f5d59aef2395921cb50be302316ffb Mon Sep 17 00:00:00 2001 From: edef Date: Tue, 16 Aug 2022 02:06:13 +0000 Subject: githooks/commit-msg: don't rely on GNU sed's Q command Not using the GNU extension makes this work on macOS. Change-Id: I303034814a5f6a94d43522f35c4bf527282622de --- githooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit 1.4.1