config: drop `git_config_get_multivar_gently()` 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_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>

Patrick Steinhardt committed Jul 23, 2025 at 16:08 UTC 1bb3e41027ba65446407068a09c4855b7556fe4d
5 files changed +10 -17
branch.c
+1 -1
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
130 if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
131 goto out_err;
132 for_each_string_list_item(item, remotes)
133 - if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
133 + if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
134 goto out_err;
135
136 if (rebasing) {
builtin/clone.c
+4 -4
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
762 {
763 /*
764 * give git_clone_config a chance to write config values back to the
765 - * environment, since git_config_set_multivar_gently only deals with
765 + * environment, since repo_config_set_multivar_gently only deals with
766 * config-file writes
767 */
768 int apply_failed = git_clone_config(key, value, ctx, data);
769 if (apply_failed)
770 return apply_failed;
771
772 - return git_config_set_multivar_gently(key,
773 - value ? value : "true",
774 - CONFIG_REGEX_NONE, 0);
772 + return repo_config_set_multivar_gently(the_repository, key,
773 + value ? value : "true",
774 + CONFIG_REGEX_NONE, 0);
775 }
776
777 static void write_config(struct string_list *config)
builtin/remote.c
+2 -2
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
1633
1634 static int remove_all_fetch_refspecs(const char *key)
1635 {
1636 - return git_config_set_multivar_gently(key, NULL, NULL,
1637 - CONFIG_FLAGS_MULTI_REPLACE);
1636 + return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
1637 + CONFIG_FLAGS_MULTI_REPLACE);
1638 }
1639
1640 static void add_branches(struct remote *remote, const char **branches,
config.h
-7
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
745 key, value, value_pattern, flags);
746 }
747
748 -static inline int git_config_set_multivar_gently(const char *key, const char *value,
749 - const char *value_pattern, unsigned flags)
750 -{
751 - return repo_config_set_multivar_gently(the_repository, key, value,
752 - value_pattern, flags);
753 -}
754 -
748 static inline void git_config_set_multivar(const char *key, const char *value,
749 const char *value_pattern, unsigned flags)
750 {
scalar.c
+3 -3
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
196 if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
197 trace2_data_string("scalar", the_repository,
198 "log.excludeDecoration", "created");
199 - if (git_config_set_multivar_gently("log.excludeDecoration",
200 - "refs/prefetch/*",
201 - CONFIG_REGEX_NONE, 0))
199 + if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration",
200 + "refs/prefetch/*",
201 + CONFIG_REGEX_NONE, 0))
202 return error(_("could not configure "
203 "log.excludeDecoration"));
204 } else {