]> git.ipfire.org Git - thirdparty/git.git/commit
config: store "git -c" variables using more robust format
authorPatrick Steinhardt <ps@pks.im>
Tue, 12 Jan 2021 12:27:01 +0000 (13:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Jan 2021 21:03:18 +0000 (13:03 -0800)
commit1ff21c05ba99ed2d0ade8318e3cb0c1a3f8d4b80
tree5a5c333541cec7abf57326559fc958a556dadc7b
parentf9dbb64fadf599c588a39d2251bb3f9a2f7d572a
config: store "git -c" variables using more robust format

The previous commit added a new format for $GIT_CONFIG_PARAMETERS which
is able to robustly handle subsections with "=" in them. Let's start
writing the new format. Unfortunately, this does much less than you'd
hope, because "git -c" itself has the same ambiguity problem! But it's
still worth doing:

  - we've now pushed the problem from the inter-process communication
    into the "-c" command-line parser. This would free us up to later
    add an unambiguous format there (e.g., separate arguments like "git
    --config key value", etc).

  - for --config-env, the parser already disallows "=" in the
    environment variable name. So:

      git --config-env section.with=equals.key=ENVVAR

    will robustly set section.with=equals.key to the contents of
    $ENVVAR.

The new test shows the improvement for --config-env.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/t1300-config.sh