Subject: Re: [PATCH v5 3/3] config: allow overriding of global and system configuration

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 22 Apr 2021 07:36:45 +0200

On Wed, Apr 21, 2021 at 11:06:14PM +0200, SZEDER Gábor wrote:
> On Wed, Apr 21, 2021 at 10:46:37PM +0200, SZEDER Gábor wrote:
> > On Mon, Apr 19, 2021 at 02:31:16PM +0200, Patrick Steinhardt wrote:
[snip]
> > test_expect_success 'override global and system config' '
> >         test_when_finished rm -f "$HOME"/.config/git &&
> > 
> >         cat >"$HOME"/.gitconfig <<-EOF &&
> >         [home]
> >                 config = true
> >         EOF
> >         mkdir -p "$HOME"/.config/git &&
> >         cat >"$HOME"/.config/git/config <<-EOF &&
> >         [xdg]
> >                 config = true
> >         EOF
> >         cat >.git/config <<-EOF &&
> >         [local]
> >                 config = true
> >         EOF
> >         cat >custom-global-config <<-EOF &&
> >         [global]
> >                 config = true
> >         EOF
> >         cat >custom-system-config <<-EOF &&
> >         [system]
> >                 config = true
> >         EOF
> > 
> >         cat >expect <<-EOF &&
> >         global  xdg.config=true
> >         global  home.config=true
> >         local   local.config=true
> >         EOF
> >         git config --show-scope --list >output &&
> >         test_cmp expect output &&
> > 
> >         sane_unset GIT_CONFIG_NOSYSTEM &&
> 
> Unsetting GIT_CONFIG_NOSYSTEM like this does affect the environment of
> all subsequent tests and their git commands will then try to look at
> the system config file.
> 
> Putting this 'sane_unset' and the rest of this test case in a subshell
> seems to fix the issue.

Ah, that makes sense. Thanks for digging into the issue, I'll send a fix
for this later today.

Patrick