Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
7807051e 83bd9e03

+5 -10
+1 -1
builtin/gc.c
··· 1916 git_config_set("maintenance.auto", "false"); 1917 1918 /* Set maintenance strategy, if unset */ 1919 - if (git_config_get("maintenance.strategy")) 1920 git_config_set("maintenance.strategy", "incremental"); 1921 1922 if (!git_config_get_string_multi(key, &list)) {
··· 1916 git_config_set("maintenance.auto", "false"); 1917 1918 /* Set maintenance strategy, if unset */ 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)) {
+3 -3
builtin/submodule--helper.c
··· 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")) 553 module_list_active(&list); 554 555 info.prefix = 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")) 2882 module_list_active(&list); 2883 2884 info.prefix = opt.prefix; ··· 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")) { 3353 /* 3354 * If the submodule being added isn't already covered by the 3355 * current configured pathspec, set the submodule's active flag
··· 549 * If there are no path args and submodule.active is set then, 550 * by default, only initialize 'active' modules. 551 */ 552 + if (!argc && !repo_config_get(the_repository, "submodule.active")) 553 module_list_active(&list); 554 555 info.prefix = 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 && !repo_config_get(the_repository, "submodule.active")) 2882 module_list_active(&list); 2883 2884 info.prefix = opt.prefix; ··· 3349 * is_submodule_active(), since that function needs to find 3350 * out the value of "submodule.active" again anyway. 3351 */ 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
-5
config.h
··· 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 - 727 static inline int git_config_get_value(const char *key, const char **value) 728 { 729 return repo_config_get_value(the_repository, key, value);
··· 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_value(const char *key, const char **value) 723 { 724 return repo_config_get_value(the_repository, key, value);
+1 -1
t/helper/test-config.c
··· 137 } else if (argc == 3 && !strcmp(argv[1], "get")) { 138 int ret; 139 140 - if (!(ret = git_config_get(argv[2]))) 141 goto exit0; 142 else if (ret == 1) 143 printf("Value not found for \"%s\"\n", argv[2]);
··· 137 } else if (argc == 3 && !strcmp(argv[1], "get")) { 138 int ret; 139 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]);