On 4/29/2022 3:06 PM, SZEDER Gábor wrote: > On Fri, Apr 29, 2022 at 10:57:58AM -0700, Junio C Hamano wrote: >> Derrick Stolee <derrickstolee@xxxxxxxxxx> 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. > 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