Skip to content

fix: forward GIT_CONFIG_* overrides in baseEnv - #2015

Closed
peda-cos wants to merge 1 commit into
defilantech:mainfrom
peda-cos:fix/git-config-env-passthrough
Closed

peda-cos wants to merge 1 commit into
defilantech:mainfrom
peda-cos:fix/git-config-env-passthrough

Conversation

@peda-cos

Copy link
Copy Markdown

Fixes #2013

baseEnv() dropped GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM/GIT_CONFIG_NOSYSTEM when building the minimal env for runGit, so the standard override variables (e.g. GIT_CONFIG_GLOBAL=/dev/null) never reached git and config rewrite rewrites kept breaking TestRemoteURL.

The three variables are now forwarded when set. Reproduce: HOME=<dir with insteadOf in .gitconfig> GIT_CONFIG_GLOBAL=/dev/null go test ./pkg/foreman/agent/repo -run TestRemoteURL — fails on main, passes with this change.

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.
@peda-cos
peda-cos requested a review from Defilan as a code owner October 12, 2026 17:35
@peda-cos

Copy link
Copy Markdown
Author

Superseded by #2014, which merged the same fix a few hours after this PR was opened: baseEnv() now forwards GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM, and GIT_CONFIG_NOSYSTEM when set (pkg/foreman/agent/repo/branch.go), Clone uses baseEnv() (clone.go), and there are dedicated tests (TestBaseEnv, TestCloneGitConfigGlobalForwarding) pinning the behavior. Closing this one — the empty diff after rebasing onto main would carry no value. Thanks!

@peda-cos peda-cos closed this Oct 12, 2026
@Defilan

Defilan commented Oct 13, 2026

Copy link
Copy Markdown
Member

Hey @peda-cos ! Thank you so much for your PR! Sorry, I was working on that same one right as you submitted your PR. If you're interested, I would love to have you contribute on any of the other issues. Let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestRemoteURL fails under a global git insteadOf rewrite; runGit drops GIT_CONFIG_* overrides

2 participants