Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-08 Thread Jeff King
On Sun, Feb 07, 2016 at 08:44:50PM +0100, Lars Schneider wrote: > > Are there any other reasons why current_config_filename() would return > > NULL, besides command-line config? I don't think so. It looks like we > > can read config from stdin, but we use the token "" there for the > > name field

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-08 Thread Jeff King
On Sun, Feb 07, 2016 at 08:28:26PM +0100, Lars Schneider wrote: > > I think he inherited the "--sources" name from me. :) I agree it could > > be better. I think "--show-filename" is not right as there are > > non-filename cases. Just "--origin" sounds funny to me, perhaps because > > of git's no

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-08 Thread Jeff King
On Mon, Feb 08, 2016 at 12:25:58PM +0100, Sebastian Schuberth wrote: > On 2/5/2016 14:58, Jeff King wrote: > > >Yeah, I agree it's unlikely. And the output is already ambiguous, as the > >first field could be a blob (though I guess the caller knows if they > >passed "--blob" or not). If we really

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-08 Thread Sebastian Schuberth
On 2/5/2016 14:58, Jeff King wrote: Yeah, I agree it's unlikely. And the output is already ambiguous, as the first field could be a blob (though I guess the caller knows if they passed "--blob" or not). If we really wanted an unambiguous output, we could have something like "file:...", "blob:...

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-08 Thread Sebastian Schuberth
On Sun, Feb 7, 2016 at 8:28 PM, Lars Schneider wrote: >>> However, the naming of the '--sources' option sounds a bit misleading to me. >>> It has nothing to do with source code. So maybe better name it '--origin', >>> or even more verbose '--show-origin' or '--show-filename'? >> >> I think he inh

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-07 Thread Lars Schneider
On 05 Feb 2016, at 14:58, Jeff King wrote: > On Fri, Feb 05, 2016 at 12:31:15PM +0100, Sebastian Schuberth wrote: > >>> I'm not sure returning here is the best idea. We won't have a config >>> filename if we are reading from "-c", but if we return early from this >>> function, it parses differe

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-07 Thread Lars Schneider
On 05 Feb 2016, at 12:22, Jeff King wrote: > On Fri, Feb 05, 2016 at 12:13:04PM +0100, Sebastian Schuberth wrote: > >> On 2/5/2016 9:42, larsxschnei...@gmail.com wrote: >> >>> Teach 'git config' the '--sources' option to print the source >>> configuration file for every printed value. >> >> Y

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-07 Thread Lars Schneider
On 05 Feb 2016, at 12:20, Jeff King wrote: > On Fri, Feb 05, 2016 at 09:42:30AM +0100, larsxschnei...@gmail.com wrote: > >> @@ -538,6 +569,17 @@ int cmd_config(int argc, const char **argv, const char >> *prefix) >> error("--name-only is only applicable to --list or >> --get-regex

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread Jeff King
On Fri, Feb 05, 2016 at 12:31:15PM +0100, Sebastian Schuberth wrote: > >I'm not sure returning here is the best idea. We won't have a config > >filename if we are reading from "-c", but if we return early from this > >function, it parses differently than every other line. E.g., with your > >patch,

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread Sebastian Schuberth
On 2/5/2016 12:20, Jeff King wrote: Hmm. I had originally envisioned this only being used with "--list", but I guess it makes sense to say "--sources --get" to show where the value for a particular option is coming from. Being able to use "--sources --get" is a feature that I'd definitely lik

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread Jeff King
On Fri, Feb 05, 2016 at 12:13:04PM +0100, Sebastian Schuberth wrote: > On 2/5/2016 9:42, larsxschnei...@gmail.com wrote: > > >Teach 'git config' the '--sources' option to print the source > >configuration file for every printed value. > > Yay, not being able to see where a config setting origina

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread Jeff King
On Fri, Feb 05, 2016 at 09:42:30AM +0100, larsxschnei...@gmail.com wrote: > @@ -538,6 +569,17 @@ int cmd_config(int argc, const char **argv, const char > *prefix) > error("--name-only is only applicable to --list or > --get-regexp"); > usage_with_options(builtin_confi

Re: [PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread Sebastian Schuberth
On 2/5/2016 9:42, larsxschnei...@gmail.com wrote: Teach 'git config' the '--sources' option to print the source configuration file for every printed value. Yay, not being able to see where a config setting originates from has bothered me in the past, too. So thanks for working on this. Howe

[PATCH v1] config: add '--sources' option to print the source of a config value

2016-02-05 Thread larsxschneider
From: Lars Schneider If config values are queried using 'git config' (e.g. via '--list' flag or the '--get*' flags) then it is sometimes hard to find the configuration file where the values were defined. Teach 'git config' the '--sources' option to print the source configuration file for every p