aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-23 16:08:36 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-23 08:15:21 -0700
commit62c1ed3e9d03b7434fd86c257fa04abe47e7b626 (patch)
tree217b77b7908420cd91f8b6108cf4a8878731b515 /builtin
parente957ed2b275b3fd44475bacaf3955cf451a976c4 (diff)
downloadgit-62c1ed3e9d03b7434fd86c257fa04abe47e7b626.tar.gz
config: drop `git_config_set_in_file_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_set_in_file_gently()`. All callsites are adjusted so that they use `repo_config_set_in_file_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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/config.c14
-rw-r--r--builtin/submodule--helper.c2
-rw-r--r--builtin/worktree.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/builtin/config.c b/builtin/config.c
index af5d79eadc..f7e718c670 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -970,8 +970,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
argv[0], value, value_pattern,
comment, flags);
} else {
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1014,8 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
argv[0], NULL, value_pattern,
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0],
- NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
+ NULL, NULL);
location_options_release(&location_opts);
return ret;
@@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
check_write(&location_opts.source);
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
- ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
@@ -1354,8 +1354,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
argv[0], NULL, argv[1],
NULL, flags);
else
- ret = git_config_set_in_file_gently(location_opts.source.file,
- argv[0], NULL, NULL);
+ ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
+ argv[0], NULL, NULL);
}
else if (actions == ACTION_UNSET_ALL) {
check_write(&location_opts.source);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 710a2a2004..28f34f7bc1 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,
submodule_to_gitdir(the_repository, &sb, path);
strbuf_addstr(&sb, "/config");
- if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))
+ if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))
die(_("failed to update remote for submodule '%s'"),
path);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index b1306248de..fd517c82c4 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -384,8 +384,8 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
if (!git_configset_get(&cs, "core.worktree") &&
- git_config_set_in_file_gently(to_file,
- "core.worktree", NULL, NULL))
+ repo_config_set_in_file_gently(the_repository, to_file,
+ "core.worktree", NULL, NULL))
error(_("failed to unset '%s' in '%s'"),
"core.worktree", to_file);