Re: RFC GSoC idea: new "git config" features
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:10
Jeff King [off-list ref] writes:
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.