Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
2f124256 7807051e

+7 -12
+2 -2
builtin/gc.c
··· 114 114 const char *value; 115 115 timestamp_t expire; 116 116 117 - if (!git_config_get_value(var, &value) && value) { 117 + if (!repo_config_get_value(the_repository, var, &value) && value) { 118 118 if (parse_expiry_date(value, &expire)) 119 119 die(_("failed to parse '%s' value '%s'"), var, value); 120 120 return expire == 0; ··· 178 178 char *owned = NULL; 179 179 unsigned long ulongval; 180 180 181 - if (!git_config_get_value("gc.packrefs", &value)) { 181 + if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) { 182 182 if (value && !strcmp(value, "notbare")) 183 183 cfg->pack_refs = -1; 184 184 else
+3 -3
builtin/pull.c
··· 312 312 { 313 313 const char *value; 314 314 315 - if (git_config_get_value("pull.ff", &value)) 315 + if (repo_config_get_value(the_repository, "pull.ff", &value)) 316 316 return NULL; 317 317 318 318 switch (git_parse_maybe_bool(value)) { ··· 343 343 if (curr_branch) { 344 344 char *key = xstrfmt("branch.%s.rebase", curr_branch->name); 345 345 346 - if (!git_config_get_value(key, &value)) { 346 + if (!repo_config_get_value(the_repository, key, &value)) { 347 347 enum rebase_type ret = parse_config_rebase(key, value, 1); 348 348 free(key); 349 349 return ret; ··· 352 352 free(key); 353 353 } 354 354 355 - if (!git_config_get_value("pull.rebase", &value)) 355 + if (!repo_config_get_value(the_repository, "pull.rebase", &value)) 356 356 return parse_config_rebase("pull.rebase", value, 1); 357 357 358 358 *rebase_unspecified = 1;
-5
config.h
··· 719 719 int lookup_config(const char **mapping, int nr_mapping, const char *var); 720 720 721 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 - 727 722 static inline int git_config_get_value_multi(const char *key, const struct string_list **dest) 728 723 { 729 724 return repo_config_get_value_multi(the_repository, key, dest);
+1 -1
rebase-interactive.c
··· 30 30 { 31 31 const char *value; 32 32 33 - if (git_config_get_value("rebase.missingcommitscheck", &value) || 33 + if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) || 34 34 !strcasecmp("ignore", value)) 35 35 return MISSING_COMMIT_CHECK_IGNORE; 36 36 if (!strcasecmp("warn", value))
+1 -1
t/helper/test-config.c
··· 110 110 fprintf(stderr, "Please, provide a command name on the command-line\n"); 111 111 goto exit1; 112 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 114 if (!v) 115 115 printf("(NULL)\n"); 116 116 else