-
Notifications
You must be signed in to change notification settings - Fork 898
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
I'm testing some git capabilities writing tests, and I'd like to avoid writing to the user system. For that, git is aware of GIT_CONFIG_SYSTEM and GIT_CONFIG_GLOBAL to avoid messing up with that.
These env vars are not used by the library, which could be handy for testing purposes.
go-git Version
5.11.0
Steps to Reproduce
This shell script works verifies it:
tmpdir="$(mktemp -d)"
export GIT_CONFIG_SYSTEM="$tmpdir/system.gitconfig"
export GIT_CONFIG_GLOBAL=/dev/null
export XDG_CONFIG_HOME="$tmpdir/xdg"
export HOME="$tmpdir/home"
mkdir -p "$tmpdir/xdg" "$tmpdir/home"
# Write “system” config safely without sudo:
git config --system user.name "Test System User"
git config --system user.email "system@example.com"
# Verify precedence works as expected:
git config --list --show-origin
# ...run your test commands here...
rm -rf "$tmpdir"Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working