git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git config --help not functional on bad config

From
Stefan Beller <sbeller@google.com>
Date
Jul 11, 2017, 19:13 UTC
Message-ID
<CAGZ79kbL=Ry_6L9iJw1GQA39gdPsS=twoJFpKPc3ZP+M2saoWA@mail.gmail.com>
In-Reply-To
<20170711190846.jr53xhwa42uz4ky2@sigill.intra.peff.net>
On Tue, Jul 11, 2017 at 12:08 PM, Jeff King <peff@peff.net> wrote:
Show 31 quoted lines
> On Tue, Jul 11, 2017 at 12:05:01PM -0700, Stefan Beller wrote:
>
>> > 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().

Good point. While looking at it, parse_help_format can also die, so building a safe git help config is hard:

    git config --global help.format foo
    # everything is broken, how do I fix it?
    git help config # breaks, too, for the same reason as you outlined :/
Previous: Jeff KingNext: Jeff King
Message 5 of 6 in “git config --help not functional on bad config”
  1. Peter KreftingJul 11, 2017
  2. Jeff KingJul 11, 2017
  3. Stefan BellerJul 11, 2017
  4. Jeff KingJul 11, 2017
  5. Stefan BellerJul 11, 2017
  6. Jeff KingJul 11, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.