Skip to content

Commit 1bb3e41

Browse files
pks-tgitster
authored andcommitted
config: drop git_config_get_multivar_gently() wrapper
In 036876a (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent adf9e5f commit 1bb3e41

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
130130
if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
131131
goto out_err;
132132
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)
134134
goto out_err;
135135

136136
if (rebasing) {

builtin/clone.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
762762
{
763763
/*
764764
* 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
766766
* config-file writes
767767
*/
768768
int apply_failed = git_clone_config(key, value, ctx, data);
769769
if (apply_failed)
770770
return apply_failed;
771771

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);
775775
}
776776

777777
static void write_config(struct string_list *config)

builtin/remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
16331633

16341634
static int remove_all_fetch_refspecs(const char *key)
16351635
{
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);
16381638
}
16391639

16401640
static void add_branches(struct remote *remote, const char **branches,

config.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
745745
key, value, value_pattern, flags);
746746
}
747747

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-
755748
static inline void git_config_set_multivar(const char *key, const char *value,
756749
const char *value_pattern, unsigned flags)
757750
{

scalar.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
196196
if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
197197
trace2_data_string("scalar", the_repository,
198198
"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))
202202
return error(_("could not configure "
203203
"log.excludeDecoration"));
204204
} else {

0 commit comments

Comments
 (0)