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

Re: [PATCH v2 0/2] Config conditional include

From
Jeff King <peff@peff.net>
Date
Jun 28, 2016, 21:03 UTC
Message-ID
<20160628210309.GC21002@sigill.intra.peff.net>
In-Reply-To
<vpqk2h9qbp8.fsf@anie.imag.fr>
On Tue, Jun 28, 2016 at 10:51:15PM +0200, Matthieu Moy wrote:
Show 23 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > On Tue, Jun 28, 2016 at 07:26:39PM +0200, Nguyễn Thái Ngọc Duy wrote:
> >
> >> There's a surprise about core.ignorecase. We are matching paths, so we
> >> should match case-insensitively if core.ignorecase tells us so. And it
> >> gets a bit tricky if core.ignorecase is defined in the same config
> >> file. I don't think we have ever told the user that keys are processed
> >> from top down. We do now.
> >
> > Hrm. I'm not excited about introducing ordering issues into the config
> > parsing.
> 
> There's already at least one case of ordering-sensitive variables, that
> we encountered when writting the config cache during Tanay Abhra's GSoC:
> diff.<driver>.funcname Vs diff.<driver>.xfuncname. Git applies the "last
> one wins" policy, which is the normal rule for a single-valued variable,
> but in this case, a "funcname" definition can override an "xfuncname"
> def. To preserve this behavior we had to introduce ordering in the
> cache, but to me this was a design mistake to rely on order.
> 
> In short: we already have one, but I'm not excited either about
> introducing new ones.

I still see funcname versus xfuncname as fundamentally a "last one wins" scenario; it's just that the two options are sort-of synonyms. But we are still talking about the same linear-ish parsing scheme, and I think it just makes the implementation a little more complicated.

I'm much more worried about something that impacts how we parse the config, and is set up in a possibly unrelated config-parsing sequence. So whether ignorecase will work depends on more variables:

 - are we doing our config parse before or after somebody has called
   git_config() at the start of a program?
 - if before (or during), does our callback call git_default_core_config()?
 - if so, did core.ignorecase appear before our include? (Almost
   certainly not, if our include is in ~/.gitconfig, because we parse
   from least-specific to most-specific).

So here it is not the implementation that is complicated, but the user-facing behavior. It's very difficult to predict when your include will kick in, and there is a good chance it will behave differently for different programs.

In general I think the best bet here is to lazy-load such values from the config-cache (so we _know_ that we got a complete parse before we look at the value). But that creates a recursion problem when we try to lazy-load from inside the config parser itself.

-Peff
Previous: Matthieu MoyNext: Duy Nguyen
Message 44 of 46 in “config: add conditional include”
  1. config: add conditional includeNguyễn Thái Ngọc Duy, Jun 26, 2016
  2. Jeff KingJun 26, 2016
  3. Duy NguyenJun 27, 2016
  4. Jeff KingJun 27, 2016
  5. Duy NguyenJun 27, 2016
  6. Jeff KingJun 27, 2016
  7. 0/2 Config conditional includeNguyễn Thái Ngọc Duy, Jun 28, 2016
  8. 2/2 config: add conditional includeNguyễn Thái Ngọc Duy, Jun 28, 2016
  9. Jeff KingJun 28, 2016
  10. Duy NguyenJun 29, 2016
  11. Eric SunshineJun 28, 2016
  12. config: add conditional includeNguyễn Thái Ngọc Duy, Jul 12, 2016
  13. Matthieu MoyJul 13, 2016
  14. Jeff KingJul 13, 2016
  15. Matthieu MoyJul 13, 2016
  16. Duy NguyenJul 13, 2016
  17. config: add conditional includeNguyễn Thái Ngọc Duy, Jul 14, 2016
  18. Johannes SchindelinJul 14, 2016
  19. Duy NguyenJul 14, 2016
  20. Johannes SchindelinJul 16, 2016
  21. Duy NguyenJul 16, 2016
  22. Jeff KingJul 16, 2016
  23. Johannes SchindelinJul 16, 2016
  24. Jeff KingJul 16, 2016
  25. Johannes SchindelinJul 17, 2016
  26. Jeff KingJul 20, 2016
  27. Junio C HamanoJul 20, 2016
  28. Jakub NarębskiJul 20, 2016
  29. Duy NguyenAug 13, 2016
  30. Jeff KingAug 19, 2016
  31. Jakub NarębskiAug 20, 2016
  32. Duy NguyenAug 22, 2016
  33. Matthieu MoyAug 22, 2016
  34. Duy NguyenAug 22, 2016
  35. Matthieu MoyAug 22, 2016
  36. Duy NguyenAug 22, 2016
  37. Johannes SchindelinAug 23, 2016
  38. Duy NguyenAug 24, 2016
  39. Jakub NarębskiAug 24, 2016
  40. Jeff KingAug 24, 2016
  41. 1/2 add skip_prefix_mem helperNguyễn Thái Ngọc Duy, Jun 28, 2016
  42. Jeff KingJun 28, 2016
  43. Matthieu MoyJun 28, 2016
  44. Jeff KingJun 28, 2016
  45. Duy NguyenJun 29, 2016
  46. Junio C HamanoJun 28, 2016

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.