Re: [PATCH 2/3] t0033-safe-directory: check when 'safe.directory' is ignored
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 10, 2022, 20:18 UTC
- Message-ID
- <69897c46-abe7-f4d0-b43a-f60e0215927c@sunshineco.com>
- In-Reply-To
- <YnrDK0wCV6taY1QX@nand.local>
On 5/10/22 3:55 PM, Taylor Blau wrote:
Show 11 quoted lines
> On Tue, May 10, 2022 at 08:33:21PM +0200, SZEDER Gábor wrote: >> On Fri, Apr 29, 2022 at 03:19:01PM -0400, Derrick Stolee wrote: >>> Would it be simpler to use this? >>> >>> GIT_TEST_ASSUME_DIFFERENT_USER=0 git config --unset safe.directory >> >> Oh, wow. This is so obvious, no wonder it didn't occur to me :) > > Don't we consider this one-shot environment variable to be sticky on > some shells (i.e., that it persists beyond just the "git config" > invocation here)?
Almost. Some old/buggy shells incorrectly allow the one-shot environment variable assignment to bleed past command invocation when the "command" is a shell function, like this:
SOME_ENV_VAR=somevalue shell_function_call
We do "lint"[*] for that sort of problem in t/check-non-portable-shell.pl.
Stolee's example, however, is invoking a normal program (`git`, in this case), so isn't subject to that unwanted behavior from buggy shells.
[*]: a0a630192d (t/check-non-portable-shell: detect "FOO=bar shell_func", 2018-07-13)