config: drop `git_config_get_value()` 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_get_value()`. All callsites are adjusted so that they use `repo_config_get_value(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>

Patrick Steinhardt committed Jul 23, 2025 at 16:08 UTC 2f1242567ebe48f7f61df138f37b226256b7c4c6
5 files changed +7 -12
builtin/gc.c
+2 -2
@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)
114 const char *value;
115 timestamp_t expire;
116
117 - if (!git_config_get_value(var, &value) && value) {
117 + if (!repo_config_get_value(the_repository, var, &value) && value) {
118 if (parse_expiry_date(value, &expire))
119 die(_("failed to parse '%s' value '%s'"), var, value);
120 return expire == 0;
@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)
178 char *owned = NULL;
179 unsigned long ulongval;
180
181 - if (!git_config_get_value("gc.packrefs", &value)) {
181 + if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
182 if (value && !strcmp(value, "notbare"))
183 cfg->pack_refs = -1;
184 else
builtin/pull.c
+3 -3
@@ -312,7 +312,7 @@ static const char *config_get_ff(void)
312 {
313 const char *value;
314
315 - if (git_config_get_value("pull.ff", &value))
315 + if (repo_config_get_value(the_repository, "pull.ff", &value))
316 return NULL;
317
318 switch (git_parse_maybe_bool(value)) {
@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
343 if (curr_branch) {
344 char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
345
346 - if (!git_config_get_value(key, &value)) {
346 + if (!repo_config_get_value(the_repository, key, &value)) {
347 enum rebase_type ret = parse_config_rebase(key, value, 1);
348 free(key);
349 return ret;
@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
352 free(key);
353 }
354
355 - if (!git_config_get_value("pull.rebase", &value))
355 + if (!repo_config_get_value(the_repository, "pull.rebase", &value))
356 return parse_config_rebase("pull.rebase", value, 1);
357
358 *rebase_unspecified = 1;
config.h
-5
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
719 int lookup_config(const char **mapping, int nr_mapping, const char *var);
720
721 # ifdef USE_THE_REPOSITORY_VARIABLE
722 -static inline int git_config_get_value(const char *key, const char **value)
723 -{
724 - return repo_config_get_value(the_repository, key, value);
725 -}
726 -
722 static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
723 {
724 return repo_config_get_value_multi(the_repository, key, dest);
rebase-interactive.c
+1 -1
@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)
30 {
31 const char *value;
32
33 - if (git_config_get_value("rebase.missingcommitscheck", &value) ||
33 + if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) ||
34 !strcasecmp("ignore", value))
35 return MISSING_COMMIT_CHECK_IGNORE;
36 if (!strcasecmp("warn", value))
t/helper/test-config.c
+1 -1
@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)
110 fprintf(stderr, "Please, provide a command name on the command-line\n");
111 goto exit1;
112 } else if (argc == 3 && !strcmp(argv[1], "get_value")) {
113 - if (!git_config_get_value(argv[2], &v)) {
113 + if (!repo_config_get_value(the_repository, argv[2], &v)) {
114 if (!v)
115 printf("(NULL)\n");
116 else