[PATCH] prepare-commit-msg: Add compatibility check for --default-prefix option

From: Mark Zhuang <mark.zhuang@spacemit.com>

The previous commit added --default-prefix to handle non-default git
prefix configurations, but this option is not available in older git
versions. This patch adds a compatibility check.

contrib/ChangeLog:

	* prepare-commit-msg: check --default-prefix
This commit is contained in:
Mark Zhuang
2025-12-05 22:16:25 -07:00
committed by Jeff Law
parent 528df313f6
commit bc46466ec7

View File

@@ -78,4 +78,9 @@ else
tee="cat"
fi
git $cmd --default-prefix | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE"
# Use --default-prefix if supported
if git diff --help | grep -q "\-\-default-prefix" 2>/dev/null; then
cmd="$cmd --default-prefix"
fi
git $cmd | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE"