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

Re: RFC GSoC idea: new "git config" features

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2014, 20:07 UTC
Message-ID
<xmqqzjl7nj0p.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140301075247.GF20397@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> Most callbacks would convert to a query system in a pretty
> straightforward way, but some that have side effects might be tricky.
> Converting them all may be too large for a GSoC project, but I think you
> could do it gradually:
>
>   1. Convert the parser to read into an in-memory representation, but
>      leave git_config() as a wrapper which iterates over it.
>
>   2. Add query functions like config_string_get() above.
>
>   3. Convert callbacks to query functions one by one.
>
>   4. Eventually drop git_config().
>
> A GSoC project could take us partway through (3).

I actually discarded the "read from these config files to preparsed structure to memory, later to be consumed by repeated calls to the git_config() callback functions, making the only difference from the current scheme that the preparsed structure will be reset when there is the new 'reset to the original' definition" as obvious and uninteresting.

This is one of these times that I find myself blessed with capable others that can go beyond, building on top of such an idea that I may have discarded without thinking it through, around me ;-)

Yes, the new abstraction like config_<type>_get() that can live alongside the existing "git_config() feeds callback chain everything" and gradually replace the latter, would be a good way forward. Given that we read configuration multiple times anyway for different purposes, even without the new abstraction, the end result might perform better if we read the files once and reused in later calls to git_config().

Thanks.
Previous: Junio C Hamano
Message 8 of 8 in “RFC GSoC idea: new "git config" features”
  1. Michael HaggertyFeb 28, 2014
  2. Junio C HamanoFeb 28, 2014
  3. Michael HaggertyMar 1, 2014
  4. Jeff KingMar 1, 2014
  5. Matthieu MoyMar 1, 2014
  6. Jeff KingMar 14, 2014
  7. Junio C HamanoMar 14, 2014
  8. Junio C HamanoMar 3, 2014

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.