From 8c607783b973271a4b794f4b963d2a44f38cf11d Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 9 Aug 2023 09:20:15 +0800 Subject: [PATCH] Run Git hooks within xcu4 * build-aux/git-hooks/pre-commit (LC_ALL): * build-aux/git-hooks/prepare-commit-msg (SHA1): Run using xcu4 tools. --- build-aux/git-hooks/pre-commit | 8 ++++++++ build-aux/git-hooks/prepare-commit-msg | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit index f89d9ca8f8c..12b08d2c25f 100755 --- a/build-aux/git-hooks/pre-commit +++ b/build-aux/git-hooks/pre-commit @@ -21,6 +21,14 @@ LC_ALL=C export LC_ALL +# If this is a system where /bin/sh isn't sufficient to +# run git-sh-setup, use a working shell as a recourse. +if test -x "/usr/xpg4/bin/sh" && test -z "$POSIX_SHELL"; then + POSIX_SHELL=1 + export POSIX_SHELL + exec "/usr/xpg4/bin/sh" `dirname $0`/pre-commit +fi + exec >&2 . git-sh-setup diff --git a/build-aux/git-hooks/prepare-commit-msg b/build-aux/git-hooks/prepare-commit-msg index 7802dffda43..1520ef3f5f8 100755 --- a/build-aux/git-hooks/prepare-commit-msg +++ b/build-aux/git-hooks/prepare-commit-msg @@ -25,6 +25,10 @@ SHA1=$3 # Prefer gawk if available, as it handles NUL bytes properly. if type gawk >/dev/null 2>&1; then awk="gawk" +# Next use /usr/xpg4/bin/awk if available, since the script +# doesn't support Unix awk. +elif test -x /usr/xpg4/bin/awk; then + awk="/usr/xpg4/bin/awk" else awk="awk" fi -- 2.39.2