aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-13 11:14:15 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-13 10:01:04 -0700
commitc2ba4e3b5c8c1280bd3d3623b27e9ed66c788f09 (patch)
tree13aca524e30ca768508f66fbbfbfb978339e9ebe
parentconfig: pass repo to functions that rename or copy sections (diff)
downloadgit-c2ba4e3b5c8c1280bd3d3623b27e9ed66c788f09.tar.gz
git-c2ba4e3b5c8c1280bd3d3623b27e9ed66c788f09.zip
config: don't have setters depend on `the_repository`
Some of the setters that accept a `struct repository` still implicitly rely on `the_repository` via `git_config_set_multivar_in_file()`. While this function would typically use the caller-provided path, it knows to fall back to using the configuration path indicated by `the_repository`. Adapt those functions to instead use the caller-provided repository. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--config.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/config.c b/config.c
index ed39922dbb..831c9eacb0 100644
--- a/config.c
+++ b/config.c
@@ -3220,8 +3220,8 @@ int repo_config_set_worktree_gently(struct repository *r,
/* Only use worktree-specific config if it is already enabled. */
if (r->repository_format_worktree_config) {
char *file = repo_git_path(r, "config.worktree");
- int ret = git_config_set_multivar_in_file_gently(
- file, key, value, NULL, NULL, 0);
+ int ret = repo_config_set_multivar_in_file_gently(
+ r, file, key, value, NULL, NULL, 0);
free(file);
return ret;
}
@@ -3613,10 +3613,10 @@ int repo_config_set_multivar_gently(struct repository *r, const char *key,
const char *value_pattern, unsigned flags)
{
char *file = repo_git_path(r, "config");
- int res = git_config_set_multivar_in_file_gently(file,
- key, value,
- value_pattern,
- NULL, flags);
+ int res = repo_config_set_multivar_in_file_gently(r, file,
+ key, value,
+ value_pattern,
+ NULL, flags);
free(file);
return res;
}
@@ -3626,8 +3626,8 @@ void repo_config_set_multivar(struct repository *r,
const char *value_pattern, unsigned flags)
{
char *file = repo_git_path(r, "config");
- git_config_set_multivar_in_file(file, key, value,
- value_pattern, flags);
+ repo_config_set_multivar_in_file(r, file, key, value,
+ value_pattern, flags);
free(file);
}