]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: drop `git_config_get_multivar_gently()` wrapper
authorPatrick Steinhardt <ps@pks.im>
Wed, 23 Jul 2025 14:08:38 +0000 (16:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Jul 2025 15:15:21 +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_multivar_gently()`. All callsites are adjusted so that
they use `repo_config_get_multivar_gently(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>
branch.c
builtin/clone.c
builtin/remote.c
config.h
scalar.c

index 3dc237adf6c8bc2bb60072645b24923fc7a98e85..26be35834718f2c5af5e9c3c4a00db29322eb07e 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
        if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
                goto out_err;
        for_each_string_list_item(item, remotes)
-               if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
+               if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
                        goto out_err;
 
        if (rebasing) {
index f025a8f19e08d2b4d34e641dfc47537b702db9a3..183297787cb9e33edc0cc67d188911c267661d25 100644 (file)
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
 {
        /*
         * give git_clone_config a chance to write config values back to the
-        * environment, since git_config_set_multivar_gently only deals with
+        * environment, since repo_config_set_multivar_gently only deals with
         * config-file writes
         */
        int apply_failed = git_clone_config(key, value, ctx, data);
        if (apply_failed)
                return apply_failed;
 
-       return git_config_set_multivar_gently(key,
-                                             value ? value : "true",
-                                             CONFIG_REGEX_NONE, 0);
+       return repo_config_set_multivar_gently(the_repository, key,
+                                              value ? value : "true",
+                                              CONFIG_REGEX_NONE, 0);
 }
 
 static void write_config(struct string_list *config)
index 827639e0398636ce54c9441440bd68ec8e8c6485..dd340a332592cb3cdf5ec4f8855a40682049a871 100644 (file)
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
 
 static int remove_all_fetch_refspecs(const char *key)
 {
-       return git_config_set_multivar_gently(key, NULL, NULL,
-                                             CONFIG_FLAGS_MULTI_REPLACE);
+       return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
+                                              CONFIG_FLAGS_MULTI_REPLACE);
 }
 
 static void add_branches(struct remote *remote, const char **branches,
index e69592ada15c68f2ad477361784a43b7f702a873..a90b814292c7e04261d17549aace669c4789fb4f 100644 (file)
--- a/config.h
+++ b/config.h
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
                                         key, value, value_pattern, flags);
 }
 
-static inline int git_config_set_multivar_gently(const char *key, const char *value,
-                                  const char *value_pattern, unsigned flags)
-{
-       return repo_config_set_multivar_gently(the_repository, key, value,
-                                              value_pattern, flags);
-}
-
 static inline void git_config_set_multivar(const char *key, const char *value,
                             const char *value_pattern, unsigned flags)
 {
index c09c5ca194eab1854142d465534c9de1c79c1a18..4a373c133d85622a895f310529a65a2f22473f3c 100644 (file)
--- a/scalar.c
+++ b/scalar.c
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
        if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
                trace2_data_string("scalar", the_repository,
                                   "log.excludeDecoration", "created");
-               if (git_config_set_multivar_gently("log.excludeDecoration",
-                                                  "refs/prefetch/*",
-                                                  CONFIG_REGEX_NONE, 0))
+               if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration",
+                                                   "refs/prefetch/*",
+                                                   CONFIG_REGEX_NONE, 0))
                        return error(_("could not configure "
                                       "log.excludeDecoration"));
        } else {