]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: drop `git_config_get_string_multi()` wrapper
authorPatrick Steinhardt <ps@pks.im>
Wed, 23 Jul 2025 14:08:27 +0000 (16:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Jul 2025 15:15:19 +0000 (08:15 -0700)
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_get_string_multi()`. All callsites are adjusted so that they
use `repo_config_get_string_multi(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>
builtin/gc.c
builtin/log.c
config.h
reachable.c
versioncmp.c

index e94931ff48f08c9680ec859749c12d390cb7891b..f395cc57a157621244c75a076e108163ff421ddb 100644 (file)
@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
        if (repo_config_get(the_repository, "maintenance.strategy"))
                git_config_set("maintenance.strategy", "incremental");
 
-       if (!git_config_get_string_multi(key, &list)) {
+       if (!repo_config_get_string_multi(the_repository, key, &list)) {
                for_each_string_list_item(item, list) {
                        if (!strcmp(maintpath, item->string)) {
                                found = 1;
@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
        }
        if (!(config_file
              ? git_configset_get_string_multi(&cs, key, &list)
-             : git_config_get_string_multi(key, &list))) {
+             : repo_config_get_string_multi(the_repository, key, &list))) {
                for_each_string_list_item(item, list) {
                        if (!strcmp(maintpath, item->string)) {
                                found = 1;
index 1bedc4ef3551e993ed515b387191bf16dc37e1e7..b512f12e8058a371ac227fedc7a3dba2adb9871f 100644 (file)
@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
        struct string_list *include = decoration_filter->include_ref_pattern;
        const struct string_list *config_exclude;
 
-       if (!git_config_get_string_multi("log.excludeDecoration",
+       if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration",
                                         &config_exclude)) {
                struct string_list_item *item;
                for_each_string_list_item(item, config_exclude)
index e90c1c4d33587f40f43cfd760f886b63ebc3f490..f6635e48c2342be453905a88b9d1cd80ff9d1825 100644 (file)
--- a/config.h
+++ b/config.h
@@ -719,12 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
 int lookup_config(const char **mapping, int nr_mapping, const char *var);
 
 # ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_string_multi(const char *key,
-                               const struct string_list **dest)
-{
-       return repo_config_get_string_multi(the_repository, key, dest);
-}
-
 static inline int git_config_get_string(const char *key, char **dest)
 {
        return repo_config_get_string(the_repository, key, dest);
index e984b68a0c41e1064ea3a4adfa818dab7e33b8c6..8330a14fa82b96f41e6b7fe302fcaec9ce69b3d3 100644 (file)
@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)
 
        data->extra_recent_oids_loaded = 1;
 
-       if (git_config_get_string_multi("gc.recentobjectshook", &programs))
+       if (repo_config_get_string_multi(the_repository, "gc.recentobjectshook", &programs))
                return;
 
        for (i = 0; i < programs->nr; i++) {
index b6eebdb989c04264124fa501f19b6c346f56f7e1..3a81b17bc1b8d1333db4c380789add7a914c9cff 100644 (file)
@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)
                const char *const oldk = "versionsort.prereleasesuffix";
                const struct string_list *newl;
                const struct string_list *oldl;
-               int new = git_config_get_string_multi(newk, &newl);
-               int old = git_config_get_string_multi(oldk, &oldl);
+               int new = repo_config_get_string_multi(the_repository, newk, &newl);
+               int old = repo_config_get_string_multi(the_repository, oldk, &oldl);
 
                if (!new && !old)
                        warning("ignoring %s because %s is set", oldk, newk);