From 7a7671061fb8a5d66689c81bbd8c4c3d15c1cbf1 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:34:52 +0200 Subject: [PATCH] Consider all git repositories managed by aliBuild as safe. --- alibuild_helpers/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alibuild_helpers/git.py b/alibuild_helpers/git.py index b373e8db..af7672c0 100644 --- a/alibuild_helpers/git.py +++ b/alibuild_helpers/git.py @@ -84,12 +84,13 @@ def git(args, directory=".", check=True, prompt=True): err, output = getstatusoutput("""\ set -e +x cd {directory} >/dev/null 2>&1 - {prompt_var} git {args} + {prompt_var} {directory_safe_var} git {args} """.format( directory=quote(directory), args=" ".join(map(quote, args)), # GIT_TERMINAL_PROMPT is only supported in git 2.3+. prompt_var="GIT_TERMINAL_PROMPT=0" if not prompt else "", + directory_safe_var="GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0={}".format(directory) if directory else "", ), timeout=GIT_COMMAND_TIMEOUT_SEC) if check and err != 0: raise SCMError("Error {} from git {}: {}".format(err, " ".join(args), output))