-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config API & users: remove git_configset_get*(), use repo_*get*()
When the configset API was added in [1] it provided a new caching API for config reading. Before we'd need to use e.g. the git_config_bool() added in [2], but after we could use either git_configset_get_bool() or git_config_get_bool(). Then later in [3] we had "repo_*()" variants added for all of these, so now we'd also have repo_config_get_bool(). So, aside from the old functional interface we have 3x functions for every "type" depending on whether we want to use a "configset", the "lazy" API (which gets the configset from "the_repository"), or the "repo" interface (ditto, but with a custom "struct repository *r"). This commit gets rid of 1/3 of these, i.e. the configset" functions. Instead we'll use the "repo_*()" functions with a crafted "config" member, which invariably is reading some custom file, instead of the repo's entire config. This is a bit of a hack in that we now need to construct this otherwise redundant "struct repository" object. But overall this is a big win, as we'll no longer need to maintain this entire part of the API only for this use-case, which as it turns out we only needed for three callers in-tree. The resulting codepaths that read the config are also easier to understand in cases where we'd either need to use our configset, or "the_repository" config. See the maintenance_unregister() caller added in [4]. Now we don't need to alter which function we call, just our "cfg_r" object passed to repo"_config_get_*()". 1. 3c8687a (add `config_set` API for caching config-like files, 2014-07-28) 2. 1771299 (Add ".git/config" file parser, 2005-10-10) 3. 3b25622 (config: read config from a repository object, 2017-06-22) 4. 1f80129 (maintenance: add option to register in a specific config, 2022-11-09) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Loading branch information
Showing
7 changed files
with
122 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.