Re: git config --help not functional on bad config
- From
Jeff King <peff@peff.net>
- Date
- Jul 11, 2017, 19:08 UTC
- Message-ID
- <20170711190846.jr53xhwa42uz4ky2@sigill.intra.peff.net>
- In-Reply-To
- <CAGZ79kbQsRQaHjRccs-0jkYkfhBwU-gX-M3A9sP4hqTtqqpFYw@mail.gmail.com>
On Tue, Jul 11, 2017 at 12:05:01PM -0700, Stefan Beller wrote:
Show 21 quoted lines
> > diff --git a/builtin/help.c b/builtin/help.c > > index 334a8494a..c42dfc9e9 100644 > > --- a/builtin/help.c > > +++ b/builtin/help.c > > @@ -273,7 +273,7 @@ static int git_help_config(const char *var, const char *value, void *cb) > > if (starts_with(var, "man.")) > > return add_man_viewer_info(var, value); > > > > - return git_default_config(var, value, cb); > > + return 0; > > Instead of ignoring any default config, we could do > > git_default_config(var, value, cb); > /* ignore broken config, we may be the help call for config */ > return 0; > > I looked through git_default_config which seems to only die > with useful error messages for compression related settings, > but these we may want to convert to errors instead of dies, > when going this way.
There are other die calls hidden deeper. For instance:
$ git -c core.ignorecase=foo help config fatal: bad numeric config value 'foo' for 'core.ignorecase': invalid unit
Those ones are hard to fix without changing the call signature of git_config_bool().
-Peff