]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: drop `git_config_get()` wrapper
authorPatrick Steinhardt <ps@pks.im>
Wed, 23 Jul 2025 14:08:24 +0000 (16:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Jul 2025 15:15:18 +0000 (08:15 -0700)
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>
builtin/gc.c
builtin/submodule--helper.c
config.h
t/helper/test-config.c

index d9e3b9d2ec3632e1425f02d50102160071aef46d..e5c3d082edaed55ef1fb4e3e8affe3010ddf818a 100644 (file)
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
        git_config_set("maintenance.auto", "false");
 
        /* Set maintenance strategy, if unset */
-       if (git_config_get("maintenance.strategy"))
+       if (repo_config_get(the_repository, "maintenance.strategy"))
                git_config_set("maintenance.strategy", "incremental");
 
        if (!git_config_get_string_multi(key, &list)) {
index 89ee09abea6f5d788394c788c8ed9eea7b9956d9..6bcc741a6ac894bd69b7be8b72bd467f5532db4d 100644 (file)
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
         * If there are no path args and submodule.active is set then,
         * by default, only initialize 'active' modules.
         */
-       if (!argc && !git_config_get("submodule.active"))
+       if (!argc && !repo_config_get(the_repository, "submodule.active"))
                module_list_active(&list);
 
        info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
                 * If there are no path args and submodule.active is set then,
                 * by default, only initialize 'active' modules.
                 */
-               if (!argc && !git_config_get("submodule.active"))
+               if (!argc && !repo_config_get(the_repository, "submodule.active"))
                        module_list_active(&list);
 
                info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
         * is_submodule_active(), since that function needs to find
         * out the value of "submodule.active" again anyway.
         */
-       if (!git_config_get("submodule.active")) {
+       if (!repo_config_get(the_repository, "submodule.active")) {
                /*
                 * If the submodule being added isn't already covered by the
                 * current configured pathspec, set the submodule's active flag
index 4eea99e9b9561bc7999ff0006a538596b7b50edc..9261ed0f8d7f058ea38acd5ab1f9d43652341c79 100644 (file)
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
 int lookup_config(const char **mapping, int nr_mapping, const char *var);
 
 # ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get(const char *key)
-{
-       return repo_config_get(the_repository, key);
-}
-
 static inline int git_config_get_value(const char *key, const char **value)
 {
        return repo_config_get_value(the_repository, key, value);
index 41ba864790014e163fb03027497bd9c91c3c8bef..cacf6f306b1484b90b9cb8137f692a04118d5f4a 100644 (file)
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
        } else if (argc == 3 && !strcmp(argv[1], "get")) {
                int ret;
 
-               if (!(ret = git_config_get(argv[2])))
+               if (!(ret = repo_config_get(the_repository, argv[2])))
                        goto exit0;
                else if (ret == 1)
                        printf("Value not found for \"%s\"\n", argv[2]);