Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-09 Thread Taylor Blau
On Mon, Apr 09, 2018 at 08:18:18AM +0900, Junio C Hamano wrote: > Jeff King writes: > > > On Wed, Apr 04, 2018 at 07:59:12PM -0700, Taylor Blau wrote: > > > >> @@ -286,6 +288,16 @@ static int get_value(const char *key_, const char > >> *regex_) > >>config_with_options(collect_config, &values,

Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-08 Thread Junio C Hamano
Jeff King writes: > On Wed, Apr 04, 2018 at 07:59:12PM -0700, Taylor Blau wrote: > >> @@ -286,6 +288,16 @@ static int get_value(const char *key_, const char >> *regex_) >> config_with_options(collect_config, &values, >> &given_config_source, &config_options); >> >

Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-05 Thread Taylor Blau
On Thu, Apr 05, 2018 at 06:40:03PM -0400, Eric Sunshine wrote: > On Wed, Apr 4, 2018 at 10:59 PM, Taylor Blau wrote: > > [...] > > This commit (and those following it in this series) aim to eventually > > replace `--get-color` with a consistent alternative. By introducing > > `--default`, we allow

Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-05 Thread Taylor Blau
On Thu, Apr 05, 2018 at 06:29:49PM -0400, Jeff King wrote: > On Wed, Apr 04, 2018 at 07:59:12PM -0700, Taylor Blau wrote: > > > @@ -286,6 +288,16 @@ static int get_value(const char *key_, const char > > *regex_) > > config_with_options(collect_config, &values, > > &give

Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-05 Thread Eric Sunshine
On Wed, Apr 4, 2018 at 10:59 PM, Taylor Blau wrote: > [...] > This commit (and those following it in this series) aim to eventually > replace `--get-color` with a consistent alternative. By introducing > `--default`, we allow the `--get-color` action to be promoted to a > `--type=color` type speci

Re: [PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-05 Thread Jeff King
On Wed, Apr 04, 2018 at 07:59:12PM -0700, Taylor Blau wrote: > @@ -286,6 +288,16 @@ static int get_value(const char *key_, const char > *regex_) > config_with_options(collect_config, &values, > &given_config_source, &config_options); > > + if (!values.nr && d

[PATCH v4 1/3] builtin/config: introduce `--default`

2018-04-04 Thread Taylor Blau
For some use cases, callers of the `git-config(1)` builtin would like to fallback to default values when the variable asked for does not exist. In addition, users would like to use existing type specifiers to ensure that values are parsed correctly when they do exist in the configuration. For exam