From 11784b81107aecee1bf07712b13fd5d340aabbf8 Mon Sep 17 00:00:00 2001 From: Pedro Monteiro <83892026+peda-cos@users.noreply.github.com> Date: Mon, 12 Oct 2026 14:35:29 -0300 Subject: [PATCH] fix: forward GIT_CONFIG_* overrides in baseEnv runGit replaced the subprocess env, so GIT_CONFIG_GLOBAL / GIT_CONFIG_SYSTEM / GIT_CONFIG_NOSYSTEM never reached git and user-config rewrites could not be overridden in tests (#2013). The variables are now passed through when set. --- pkg/foreman/agent/repo/branch.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/foreman/agent/repo/branch.go b/pkg/foreman/agent/repo/branch.go index 440873862..f7916734d 100644 --- a/pkg/foreman/agent/repo/branch.go +++ b/pkg/foreman/agent/repo/branch.go @@ -397,5 +397,11 @@ func RebaseUnresolved(ctx context.Context, workspace, baseSHA string) (bool, str // need GIT_ASKPASS (branch, status, log). HOME is carried through so // git can read ~/.gitconfig if present. func baseEnv() []string { - return []string{"HOME=" + envOr("HOME", "/tmp")} + env := []string{"HOME=" + envOr("HOME", "/tmp")} + for _, key := range []string{"GIT_CONFIG_GLOBAL", "GIT_CONFIG_SYSTEM", "GIT_CONFIG_NOSYSTEM"} { + if v := os.Getenv(key); v != "" { + env = append(env, key+"="+v) + } + } + return env }