commit a2fb6811f5c325dff2e82373ff9ae6034860ea72
parent a09cd5e92c107a2c9e779714bd6b4dbf13590eb5
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Mon, 26 May 2025 15:02:36 +0200
bootstrap: added support for even more exotic environment
Can be backported.
Diffstat:
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/bootstrap b/bootstrap
@@ -107,13 +107,13 @@ test -n "$GIT" || GIT="$GIT_CMD"
test -n "$GIT" || GIT="$GIT_BINARY"
test -n "$GIT" || GIT="git"
-if test -d '.git'; then
+if test -d "${GIT_DIR-.git}"; then
if have_cmd "$GIT"; then
ver_GIT=`"$GIT" --version 2>/dev/null | ver_filter`
if ver_cmp "$ver_GIT" -lt "1.7"; then
echo "git version $ver_GIT detected. If you plan to contribute to development, consider installing a modern Git version."
else
- if test -f '.git/mhd2_special_config'; then :; else
+ if test -f "${GIT_DIR-.git}/mhd2_special_config"; then :; else
git_settings_modified='no'
if ver_cmp "$ver_GIT" -ge "1.7.9"; then
if git_set_VAL=`"$GIT" config --get --local --bool 'pull.rebase' 2>/dev/null` && test "$git_set_VAL" = "true"; then :; else
@@ -135,23 +135,27 @@ if test -d '.git'; then
if test "$git_settings_modified" != "no"; then
echo "Some git repository settings has been modified."
echo "Use next command to prevent such modifications in the future:"
- echo " touch '.git/mhd2_special_config'"
+ echo " touch '${GIT_DIR-.git}/mhd2_special_config'"
fi
fi
if test -f uncrustify.cfg && have_cmd ${UNCRUSTIFY}; then
- if test -f .git/hooks/pre-commit; then
+ if test -f "${GIT_DIR-.git}/hooks/pre-commit"; then
echo "Pre-commit git hook already exists, skipping installation from the upstream file."
else
echo "Installing uncrustify pre-commit git hook"
- rm -f ./.git/hooks/pre-commit
- ln -s ../../contrib/precommit_hook.sh .git/hooks/pre-commit || \
- cp contrib/precommit_hook.sh .git/hooks/pre-commit || \
+ rm -f "${GIT_DIR-.git}/hooks/pre-commit"
+ if test ${GIT_DIR+y}; then
+ ln -s "`pwd`/contrib/precommit_hook.sh" "${GIT_DIR}/hooks/pre-commit"
+ else
+ ln -s ../../contrib/precommit_hook.sh .git/hooks/pre-commit
+ fi
+ test $? -eq 0 || cp contrib/precommit_hook.sh "${GIT_DIR-.git}/hooks/pre-commit" || \
echo "Failed to install pre-commit git hook" 1>&2
if test -f "${GIT_DIR-.git}/hooks/pre-commit"; then
- if dir_GIT_HOOKS=`"$GIT" config --get core.hooksPath 2>/dev/null` && test "X$dir_GIT_HOOKS" != "X.git/hooks"; then
+ if dir_GIT_HOOKS=`"$GIT" config --get core.hooksPath 2>/dev/null` && test "X$dir_GIT_HOOKS" != "X${GIT_DIR-.git}/hooks"; then
echo "Installed hook will not be used due to git configuration."
echo "Consider updating git configuration by running the following command:"
- echo " '$GIT' config --local core.hooksPath .git/hooks"
+ echo " '$GIT' config --local core.hooksPath '${GIT_DIR-.git}/hooks'"
fi
fi
fi
@@ -161,7 +165,7 @@ if test -d '.git'; then
echo "No 'git' command detected, skipping installation of pre-commit git hook and git configuration."
fi
else
- echo "No '.git' directory found, skipping installation of pre-commit git hook and git configuration."
+ echo "No '${GIT_DIR-.git}' directory found, skipping installation of pre-commit git hook and git configuration."
fi
WANT_AUTOCONF=latest