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_set_multivar()`. All callsites are adjusted so that they use `repo_config_set_multivar(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@xxxxxx> --- builtin/branch.c | 4 ++-- builtin/clone.c | 2 +- builtin/remote.c | 20 ++++++++++---------- config.h | 7 ------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index 5de0691d18d..fa5ced452e5 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -987,10 +987,10 @@ int cmd_branch(int argc, strbuf_reset(&buf); strbuf_addf(&buf, "branch.%s.remote", branch->name); - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); strbuf_reset(&buf); strbuf_addf(&buf, "branch.%s.merge", branch->name); - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); strbuf_release(&buf); } else if (!noncreate_actions && argc > 0 && argc <= 2) { const char *branch_name = argv[0]; diff --git a/builtin/clone.c b/builtin/clone.c index 183297787cb..c990f398ef6 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -822,7 +822,7 @@ static void write_refspec_config(const char *src_ref_prefix, /* Configure the remote */ if (value.len) { strbuf_addf(&key, "remote.%s.fetch", remote_name); - git_config_set_multivar(key.buf, value.buf, "^$", 0); + repo_config_set_multivar(the_repository, key.buf, value.buf, "^$", 0); strbuf_reset(&key); if (option_mirror) { diff --git a/builtin/remote.c b/builtin/remote.c index dd340a33259..4c63a8bb576 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname, else strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s", branchname, remotename, branchname); - git_config_set_multivar(key, tmp->buf, "^$", 0); + repo_config_set_multivar(the_repository, key, tmp->buf, "^$", 0); } static const char mirror_advice[] = @@ -634,15 +634,15 @@ static int migrate_file(struct remote *remote) strbuf_addf(&buf, "remote.%s.url", remote->name); for (i = 0; i < remote->url.nr; i++) - git_config_set_multivar(buf.buf, remote->url.v[i], "^$", 0); + repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0); strbuf_reset(&buf); strbuf_addf(&buf, "remote.%s.push", remote->name); for (i = 0; i < remote->push.nr; i++) - git_config_set_multivar(buf.buf, remote->push.items[i].raw, "^$", 0); + repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0); strbuf_reset(&buf); strbuf_addf(&buf, "remote.%s.fetch", remote->name); for (i = 0; i < remote->fetch.nr; i++) - git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0); + repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0); #ifndef WITH_BREAKING_CHANGES if (remote->origin == REMOTE_REMOTES) unlink_or_warn(repo_git_path_replace(the_repository, &buf, @@ -771,7 +771,7 @@ static int mv(int argc, const char **argv, const char *prefix, if (oldremote->fetch.nr) { strbuf_reset(&buf); strbuf_addf(&buf, "remote.%s.fetch", rename.new_name); - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name); for (i = 0; i < oldremote->fetch.nr; i++) { char *ptr; @@ -791,7 +791,7 @@ static int mv(int argc, const char **argv, const char *prefix, "\tPlease update the configuration manually if necessary."), buf2.buf); - git_config_set_multivar(buf.buf, buf2.buf, "^$", 0); + repo_config_set_multivar(the_repository, buf.buf, buf2.buf, "^$", 0); } } @@ -1790,7 +1790,7 @@ static int set_url(int argc, const char **argv, const char *prefix, /* Special cases that add new entry. */ if ((!oldurl && !delete_mode) || add_mode) { if (add_mode) - git_config_set_multivar(name_buf.buf, newurl, + repo_config_set_multivar(the_repository, name_buf.buf, newurl, "^$", 0); else repo_config_set(the_repository, name_buf.buf, newurl); @@ -1814,10 +1814,10 @@ static int set_url(int argc, const char **argv, const char *prefix, regfree(&old_regex); if (!delete_mode) - git_config_set_multivar(name_buf.buf, newurl, oldurl, 0); + repo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0); else - git_config_set_multivar(name_buf.buf, NULL, oldurl, - CONFIG_FLAGS_MULTI_REPLACE); + repo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl, + CONFIG_FLAGS_MULTI_REPLACE); out: strbuf_release(&name_buf); return 0; diff --git a/config.h b/config.h index a90b814292c..61774f17db3 100644 --- a/config.h +++ b/config.h @@ -744,13 +744,6 @@ static inline void git_config_set_multivar_in_file( repo_config_set_multivar_in_file(the_repository, config_filename, key, value, value_pattern, flags); } - -static inline void git_config_set_multivar(const char *key, const char *value, - const char *value_pattern, unsigned flags) -{ - repo_config_set_multivar(the_repository, key, value, - value_pattern, flags); -} # endif /* USE_THE_REPOSITORY_VARIABLE */ #endif /* CONFIG_H */ -- 2.50.1.552.g942d659e1b.dirty