Skip to content

Commit 2f12425

Browse files
pks-tgitster
authored andcommitted
config: drop git_config_get_value() 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_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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7807051 commit 2f12425

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

builtin/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)
114114
const char *value;
115115
timestamp_t expire;
116116

117-
if (!git_config_get_value(var, &value) && value) {
117+
if (!repo_config_get_value(the_repository, var, &value) && value) {
118118
if (parse_expiry_date(value, &expire))
119119
die(_("failed to parse '%s' value '%s'"), var, value);
120120
return expire == 0;
@@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)
178178
char *owned = NULL;
179179
unsigned long ulongval;
180180

181-
if (!git_config_get_value("gc.packrefs", &value)) {
181+
if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
182182
if (value && !strcmp(value, "notbare"))
183183
cfg->pack_refs = -1;
184184
else

builtin/pull.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static const char *config_get_ff(void)
312312
{
313313
const char *value;
314314

315-
if (git_config_get_value("pull.ff", &value))
315+
if (repo_config_get_value(the_repository, "pull.ff", &value))
316316
return NULL;
317317

318318
switch (git_parse_maybe_bool(value)) {
@@ -343,7 +343,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
343343
if (curr_branch) {
344344
char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
345345

346-
if (!git_config_get_value(key, &value)) {
346+
if (!repo_config_get_value(the_repository, key, &value)) {
347347
enum rebase_type ret = parse_config_rebase(key, value, 1);
348348
free(key);
349349
return ret;
@@ -352,7 +352,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
352352
free(key);
353353
}
354354

355-
if (!git_config_get_value("pull.rebase", &value))
355+
if (!repo_config_get_value(the_repository, "pull.rebase", &value))
356356
return parse_config_rebase("pull.rebase", value, 1);
357357

358358
*rebase_unspecified = 1;

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_value(const char *key, const char **value)
723-
{
724-
return repo_config_get_value(the_repository, key, value);
725-
}
726-
727722
static inline int git_config_get_value_multi(const char *key, const struct string_list **dest)
728723
{
729724
return repo_config_get_value_multi(the_repository, key, dest);

rebase-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void)
3030
{
3131
const char *value;
3232

33-
if (git_config_get_value("rebase.missingcommitscheck", &value) ||
33+
if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) ||
3434
!strcasecmp("ignore", value))
3535
return MISSING_COMMIT_CHECK_IGNORE;
3636
if (!strcasecmp("warn", value))

t/helper/test-config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int cmd__config(int argc, const char **argv)
110110
fprintf(stderr, "Please, provide a command name on the command-line\n");
111111
goto exit1;
112112
} 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)) {
114114
if (!v)
115115
printf("(NULL)\n");
116116
else

0 commit comments

Comments
 (0)