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

Re: [PATCHv2] git-config: Parse config files leniently

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 4, 2009, 08:40 UTC
Message-ID
<7v8wgvyuf1.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4AA0BE30.1030408@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 6 quoted lines
>> *2* Worse yet, the parsing of branch.autosetuprebase is part of the
>> default_config and commands that do not have anything to do with new
>> branch creation will fail with the current setup.
>
> Thanks for the thorough explanations. Especially *2* makes me think that
> quite some restructuring would be necessary in order to "do it right".

We need to distinguish at least the "syntax" and "semantics" errors, i.e. not necessarily "do it right", but "how your patch should have looked like".

I think a slightly hacky but practical workaround then becomes possible. We can have a config callback function to parse only core.editor (and perhaps some other very minimum set of variables needed to launch the editor on the right config file) extremely loosely, i.e. not even calling git_config_string() to complain about error-nonbool. You can use the callback _only_ from the ACTION_EDIT codepath in builtin-config.c (which currently uses git_default_config and errors out when some uninteresting configuration variables have semantic errors).

That would get rid of the issue that the configuration mechanism triggers semantic errors for unrelated variables, and would give us a usable recovery editor, no?

Previous: Michael J Gruber
Message 14 of 14 in “git config -> "fatal: bad config file"”
  1. David ReitterAug 14, 2009
  2. Michael J GruberAug 14, 2009
  3. David ReitterAug 14, 2009
  4. Jakub NarebskiAug 14, 2009
  5. git-config: Parse config files lenientlyMichael J Gruber, Aug 14, 2009
  6. Junio C HamanoAug 14, 2009
  7. Michael J GruberAug 17, 2009
  8. Junio C HamanoAug 17, 2009
  9. [PATCHv2] git-config: Parse config files lenientlyMichael J Gruber, Sep 2, 2009
  10. Junio C HamanoSep 3, 2009
  11. Michael J GruberSep 3, 2009
  12. Junio C HamanoSep 3, 2009
  13. Michael J GruberSep 4, 2009
  14. Junio C HamanoSep 4, 2009

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.