Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx> writes: >> +static struct hashmap *get_config_cache(void) >> +{ >> + static struct hashmap config_cache; >> + if (!hashmap_initialized) { >> + config_cache_init(&config_cache); >> + hashmap_initialized = 1; >> + git_config(config_cache_callback, NULL); >> + } >> + return &config_cache; >> +} > > [I have not been following this series at all (sorry I haven't had > the time to spare), so take these comments with a very big pinch of > salt! ie just ignore me if it's already been discussed etc. ;-) ] > > The 'git config' command can be used to read arbitrary files (so long > as they conform to the config syntax). For example, see the --file and > --blob options to git-config. At present, I think only scripted commands > use this facility (eg git-submodule). Noting the singleton config_cache, > what happens when git-submodule becomes a C builtin, or indeed any other > C builtin wants to take advantage of the new code when processing a non- > standard config file? Yup, that is a very good point. There needs an infrastructure to tie a set of files (i.e. the standard one being the chain of system-global /etc/gitconfig to repo-specific .git/config, and any custom one that can be specified by the caller like submodule code) to a separate hashmap; a future built-in submodule code would use two hashmaps aka "config-caches", one to manage the usual "configuration" and the other to manage the contents of the .gitmodules file. When we are operating across repositories (think "recursive checkout"), we somehow have to deal with multiple sets of configuration, one that applies to the top-level superproject and others that apply to individual submodule repositories. Even there is currently one caller, the "git config" command implementation, if one is designing the new API, the design shouldn't be tied to a singleton limitation, I would have to say, so that future callers do not have to throw away everything done in this series and start from scratch. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html