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
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"