Skip to content

Commit 7807051

Browse files
pks-tgitster
authored andcommitted
config: drop git_config_get() 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()`. All callsites are adjusted so that they use `repo_config_get(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 83bd9e0 commit 7807051

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
19161916
git_config_set("maintenance.auto", "false");
19171917

19181918
/* Set maintenance strategy, if unset */
1919-
if (git_config_get("maintenance.strategy"))
1919+
if (repo_config_get(the_repository, "maintenance.strategy"))
19201920
git_config_set("maintenance.strategy", "incremental");
19211921

19221922
if (!git_config_get_string_multi(key, &list)) {

builtin/submodule--helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
549549
* If there are no path args and submodule.active is set then,
550550
* by default, only initialize 'active' modules.
551551
*/
552-
if (!argc && !git_config_get("submodule.active"))
552+
if (!argc && !repo_config_get(the_repository, "submodule.active"))
553553
module_list_active(&list);
554554

555555
info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
28782878
* If there are no path args and submodule.active is set then,
28792879
* by default, only initialize 'active' modules.
28802880
*/
2881-
if (!argc && !git_config_get("submodule.active"))
2881+
if (!argc && !repo_config_get(the_repository, "submodule.active"))
28822882
module_list_active(&list);
28832883

28842884
info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
33493349
* is_submodule_active(), since that function needs to find
33503350
* out the value of "submodule.active" again anyway.
33513351
*/
3352-
if (!git_config_get("submodule.active")) {
3352+
if (!repo_config_get(the_repository, "submodule.active")) {
33533353
/*
33543354
* If the submodule being added isn't already covered by the
33553355
* current configured pathspec, set the submodule's active flag

config.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
719719
int lookup_config(const char **mapping, int nr_mapping, const char *var);
720720

721721
# ifdef USE_THE_REPOSITORY_VARIABLE
722-
static inline int git_config_get(const char *key)
723-
{
724-
return repo_config_get(the_repository, key);
725-
}
726-
727722
static inline int git_config_get_value(const char *key, const char **value)
728723
{
729724
return repo_config_get_value(the_repository, key, value);

t/helper/test-config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
137137
} else if (argc == 3 && !strcmp(argv[1], "get")) {
138138
int ret;
139139

140-
if (!(ret = git_config_get(argv[2])))
140+
if (!(ret = repo_config_get(the_repository, argv[2])))
141141
goto exit0;
142142
else if (ret == 1)
143143
printf("Value not found for \"%s\"\n", argv[2]);

0 commit comments

Comments
 (0)