Re: [PATCH v4 3/3] config: allow overriding of global and system configuration
- From
Jeff King <peff@peff.net>
- Date
- Apr 13, 2021, 07:33 UTC
- Message-ID
- <YHVJNOjJhysn7LBy@coredump.intra.peff.net>
- In-Reply-To
- <d27efc0aa847f3fb179307b3a265b3759b7d9570.1618297711.git.ps@pks.im>
On Tue, Apr 13, 2021 at 09:11:52AM +0200, Patrick Steinhardt wrote:
Show 6 quoted lines
> +test_expect_success 'override global and system config with missing file' ' > + sane_unset GIT_CONFIG_NOSYSTEM && > + test_must_fail env GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=/dev/null git config --global --list >actual && > + test_must_fail env GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=does-not-exist git config --system --list >actual && > + GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=does-not-exist git version > +'
I was slightly surprised to see these still marked as test_must_fail. But it's because git-config, when given a _specific_ file to read, will complain if the file doesn't exist. And that is true independent of your patch.
There is one interesting implication there. Running:
GIT_CONFIG_SYSTEM=/dev/null git config --system --list
does _not_ complain, even though:
GIT_CONFIG_NOSYSTEM=1 git config --system --list
does. IMHO that is quite sensible, but I wanted to point it out, as using /dev/null is not an exact replacement for GIT_CONFIG_NOSYSTEM (in my opinion it is even better ;) ).
-Peff