config: drop `git_config_get()` wrapper

In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get()`. All callsites are adjusted so that they use `repo_config_get(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 23, 2025 at 16:08 UTC 7807051e9b58628b09e77cca396306c9022b90c0
4 files changed +5 -10
builtin/gc.c
+1 -1
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
1916 git_config_set("maintenance.auto", "false");
1917
1918 /* Set maintenance strategy, if unset */
1919 - if (git_config_get("maintenance.strategy"))
1919 + if (repo_config_get(the_repository, "maintenance.strategy"))
1920 git_config_set("maintenance.strategy", "incremental");
1921
1922 if (!git_config_get_string_multi(key, &list)) {
builtin/submodule--helper.c
+3 -3
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
549 * If there are no path args and submodule.active is set then,
550 * by default, only initialize 'active' modules.
551 */
552 - if (!argc && !git_config_get("submodule.active"))
552 + if (!argc && !repo_config_get(the_repository, "submodule.active"))
553 module_list_active(&list);
554
555 info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
2878 * If there are no path args and submodule.active is set then,
2879 * by default, only initialize 'active' modules.
2880 */
2881 - if (!argc && !git_config_get("submodule.active"))
2881 + if (!argc && !repo_config_get(the_repository, "submodule.active"))
2882 module_list_active(&list);
2883
2884 info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
3349 * is_submodule_active(), since that function needs to find
3350 * out the value of "submodule.active" again anyway.
3351 */
3352 - if (!git_config_get("submodule.active")) {
3352 + if (!repo_config_get(the_repository, "submodule.active")) {
3353 /*
3354 * If the submodule being added isn't already covered by the
3355 * current configured pathspec, set the submodule's active flag
config.h
-5
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
719 int lookup_config(const char **mapping, int nr_mapping, const char *var);
720
721 # ifdef USE_THE_REPOSITORY_VARIABLE
722 -static inline int git_config_get(const char *key)
723 -{
724 - return repo_config_get(the_repository, key);
725 -}
726 -
722 static inline int git_config_get_value(const char *key, const char **value)
723 {
724 return repo_config_get_value(the_repository, key, value);
t/helper/test-config.c
+1 -1
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
137 } else if (argc == 3 && !strcmp(argv[1], "get")) {
138 int ret;
139
140 - if (!(ret = git_config_get(argv[2])))
140 + if (!(ret = repo_config_get(the_repository, argv[2])))
141 goto exit0;
142 else if (ret == 1)
143 printf("Value not found for \"%s\"\n", argv[2]);