[PATCH v2 0/2] config: allow specifying config entries via envvar pairs
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 24, 2020, 10:50 UTC
- Message-ID
- <cover.1606214397.git.ps@pks.im>
Hi,
this is the second version of my patch series which aims to implement a way to pass config entries via the environment while avoiding any requirements to perform shell quoting on the user's side.
There's been quite some feedback on the first version, which I tried to include in this version. Changes include:
- I reworked how git detects which variables it should process.
Instead of iterating from GIT_CONFIG_KEY_0 to $n until we find the
first gap, this now uses a third environment variable
GIT_CONFIG_COUNT which specifies show many environment config
pairs should be processed. I've added this variable to the local
environment variables, so that it's properly unset when moving
between repos and printed by `git rev-parse --local-env-vars`. - Missing GIT_CONFIG_VALUE_$n keys for a given key are now treated
as an error. The same is true for any environment value which
should exist based on the value of GIT_CONFIG_COUNT. - I've changed priorities. The envvars are treated as command-level
and as such override all values configured in files. But any
explicit `git -c key=value` will now override these envvars.- I've improved test coverage to also nail down priorities.
Patrick
Patrick Steinhardt (2): config: extract function to parse config pairs config: allow specifying config entries via envvar pairs
Documentation/git-config.txt | 9 +++ cache.h | 1 + config.c | 96 +++++++++++++++++++++++++------- environment.c | 1 + t/t1300-config.sh | 105 ++++++++++++++++++++++++++++++++++- 5 files changed, 190 insertions(+), 22 deletions(-)
-- 2.29.2