Subject: Re: [PATCH v5 08/14] builtin/config: introduce "get" subcommand

From: Junio C Hamano <[email-masked]>
Date: Sun, 03 Aug 2025 15:30:32 -0700

SZEDER Gábor <[email-masked]> writes:

>>  #!/bin/sh
>> -WS=$(git config --get-color color.diff.whitespace "blue reverse")
>> -RESET=$(git config --get-color "" "reset")
>> +WS=$(git config get --type=color --default="blue reverse" color.diff.whitespace)
>> +RESET=$(git config get --type=color --default="reset" "")
>>  echo "${WS}your whitespace color or blue reverse${RESET}"
>
> In this example the second command in the postimage doesn't work:
>
>   $ RESET=$(git config get --type=color --default="reset" "")
>   error: key does not contain a section: 
>
> Consequently, the last command doesn't work as expected anymore,
> because the color is not reset at the end of the output.
>
> Luckily, the commands in the preimage still work.

Instead of an empty string as a configuration variable, using
something like no.such.variable that does not exist would also be
a workaround.  I.e.,

  RESET=$(git config get --type=color --default=reset no.such.variable)

What is bad about this is that there is no generic variable that is
guaranteed to be unset.