Re: Why does "git config" output nothing instead of the default value for unset variables?
- From
Sebastian Schuberth <sschuberth@gmail.com>
- Date
- Apr 14, 2013, 12:56 UTC
- Message-ID
- <CAHGBnuO2d9Wkez4sLLKp3Ei0vkAJBjJp1+m+Lsu3ozaKPQD29A@mail.gmail.com>
- In-Reply-To
- <CAH5451nL0cmTy+vwEsJnvX7OP1iSSgY9UMhvrrimk0zWM71YDw@mail.gmail.com>
On Sun, Apr 14, 2013 at 2:47 PM, Andrew Ardill <andrew.ardill@gmail.com> wrote:
Show 5 quoted lines
> On 14 April 2013 22:34, Sebastian Schuberth <sschuberth@gmail.com> wrote: >> Usually when I query a variable I'm not so much interested in whether it is at all (explicitly) set to some value or not, but what value is currently in use. > > With your change in place, how do you know if the config item has been > explicitly set in your system?
Well, this could be done several ways. Maybe output the variable value in all upper case if it's the implicit / built-in default, and in all lower case if it has been explicitly set somewhere.
> The closest thing I can see for doing this is git config --list, but > perhaps there should be a flag to check if a config item is set?
Yet more command line options? Well, there's probably no way around that in order to maintain backward compatibility.
Show 5 quoted lines
> More to the point, I can easily imagine many scripts relying on git > config returning a value to indicate that a config item has been set. > Your proposed change would break all those. For that reason, it might > be nicer to introduce a flag that returns the config if it is set or > the default otherwise. Something like git config --value perhaps.
Right.
-- Sebastian Schuberth