Skip to content

Commit 5d215a7

Browse files
pks-tgitster
authored andcommitted
config: drop git_config_get_bool() 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_bool()`. All callsites are adjusted so that they use `repo_config_get_bool(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 d57f078 commit 5d215a7

21 files changed

+34
-39
lines changed

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
760760
const char **argv_copy;
761761
int rc;
762762

763-
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
763+
repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
764764
repo_config(the_repository, git_default_config, NULL);
765765

766766
describe_status.max_invocations = 1;

builtin/am.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)
162162

163163
state->prec = 4;
164164

165-
git_config_get_bool("am.threeway", &state->threeway);
165+
repo_config_get_bool(the_repository, "am.threeway", &state->threeway);
166166

167167
state->utf8 = 1;
168168

169-
git_config_get_bool("am.messageid", &state->message_id);
169+
repo_config_get_bool(the_repository, "am.messageid", &state->message_id);
170170

171171
state->scissors = SCISSORS_UNSET;
172172
state->quoted_cr = quoted_cr_unset;
173173

174174
strvec_init(&state->git_apply_opts);
175175

176-
if (!git_config_get_bool("commit.gpgsign", &gpgsign))
176+
if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign))
177177
state->sign_commit = gpgsign ? "" : NULL;
178178
}
179179

@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
965965
{
966966
if (keep_cr < 0) {
967967
keep_cr = 0;
968-
git_config_get_bool("am.keepcr", &keep_cr);
968+
repo_config_get_bool(the_repository, "am.keepcr", &keep_cr);
969969
}
970970

971971
switch (patch_format) {

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,
291291
read_mmblob(&ours, &threeway[1]);
292292
read_mmblob(&theirs, &threeway[2]);
293293

294-
git_config_get_bool("merge.renormalize", &renormalize);
294+
repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
295295
ll_opts.renormalize = renormalize;
296296
ll_opts.conflict_style = conflict_style;
297297
merge_status = ll_merge(&result_buf, path, &ancestor, "base",

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,
11501150
strbuf_reset(&sb);
11511151
}
11521152

1153-
if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
1153+
if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) &&
11541154
val)
11551155
string_list_append(&option_config, "submodule.recurse=true");
11561156

builtin/credential-cache--daemon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,
307307
OPT_END()
308308
};
309309

310-
git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
310+
repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup);
311311

312312
argc = parse_options(argc, argv, prefix, options, usage, 0);
313313
socket_path = argv[0];

builtin/gc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)
193193
repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
194194
repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
195195
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
196-
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
197-
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
196+
repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto);
197+
repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs);
198198
repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
199199

200200
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
17791779
strbuf_reset(&config_name);
17801780
strbuf_addf(&config_name, "maintenance.%s.enabled",
17811781
tasks[i].name);
1782-
if (!git_config_get_bool(config_name.buf, &config_value))
1782+
if (!repo_config_get_bool(the_repository, config_name.buf, &config_value))
17831783
strategy.tasks[i].enabled = config_value;
17841784
if (!strategy.tasks[i].enabled)
17851785
continue;

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,
10581058

10591059
if (use_index && !startup_info->have_repository) {
10601060
int fallback = 0;
1061-
git_config_get_bool("grep.fallbacktonoindex", &fallback);
1061+
repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
10621062
if (fallback)
10631063
use_index = 0;
10641064
else

builtin/rebase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)
340340
unsigned flags = 0;
341341
int abbreviate_commands = 0, ret = 0;
342342

343-
git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands);
343+
repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands);
344344

345345
flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
346346
flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;

compat/precompose_utf8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)
7575
iconv_t ic_prec;
7676
char *out;
7777
if (precomposed_unicode < 0)
78-
git_config_get_bool("core.precomposeunicode", &precomposed_unicode);
78+
repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode);
7979
if (precomposed_unicode != 1)
8080
return in;
8181
ic_prec = iconv_open(repo_encoding, path_encoding);

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_bool(const char *key, int *dest)
723-
{
724-
return repo_config_get_bool(the_repository, key, dest);
725-
}
726-
727722
static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
728723
{
729724
return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);

0 commit comments

Comments
 (0)