Re: [PATCH 2/3] t0033-safe-directory: check when 'safe.directory' is ignored
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Apr 29, 2022, 19:19 UTC
- Message-ID
- <b6deba3f-9019-fb6f-7bb3-cc2f647dcff6@github.com>
- In-Reply-To
- <20220429190625.GA1626@szeder.dev>
On 4/29/2022 3:06 PM, SZEDER Gábor wrote:
Show 15 quoted lines
> On Fri, Apr 29, 2022 at 10:57:58AM -0700, Junio C Hamano wrote: >> Derrick Stolee <derrickstolee@github.com> writes: >>> test_config would do the same, right? I think it automatically >>> does the test_when_finished for us. >> >> I thought it (specifically, anything depends on test_when_finished) >> has trouble working well from inside a subprocess? > > Yeah, test_config doesn't work in a subshell, because modifying > the variable holding the cleanup commands won't be visible after > leaving the subshell, and the protection added in 0968f12a99 > (test-lib-functions: detect test_when_finished in subshell, > 2015-09-05) will kick in. And we do need a subshell to set the > config, because without unsetting GIT_TEST_ASSUME_DIFFERENT_OWNER 'git > config' would refuse to touch the config file.
Ah yes, of course.
Show 8 quoted lines
> I think something like > > test_when_finished "( > unset GIT_TEST_ASSUME_DIFFERENT_USER && > git config --unset safe.directory > )" > > would work, though.
Would it be simpler to use this?
GIT_TEST_ASSUME_DIFFERENT_USER=0 git config --unset safe.directory
Thanks, -Stolee