From: Serge Hallyn Date: Mon, 25 Apr 2022 15:42:41 +0000 (-0500) Subject: Work around git safe.directory enforcement X-Git-Tag: 4.12~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a7ed86fbad8ba5659c011647b68e2bd286ff4cc;p=thirdparty%2Fshadow.git Work around git safe.directory enforcement Git wants to ensure that you do not read .git owned by other users. But we fetch+build as 'build' user, and run tests as root user. Those tests calculate git topdir using git rev-parse --show-toplevel, which git now fails. Setting safe.directory, seems wrong. Let's just use bash to figure out the top dir. --- diff --git a/tests/common/config.sh b/tests/common/config.sh index ea66ef3c6..ffd969279 100644 --- a/tests/common/config.sh +++ b/tests/common/config.sh @@ -2,7 +2,14 @@ set -e -build_path=$(git rev-parse --show-toplevel) +build_path=$(pwd) +while [ "${build_path}" != "/" -a ! -d "${build_path}/.git" ]; do + build_path=$(dirname ${build_path}) +done +if [ ! -d "${build_path}/.git" ]; then + echo "Not inside git directory" 1>&2 + exit 1 +fi # Save the configuration files in tmp. save_config ()