config: drop `git_config_get_bool()` 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_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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 23, 2025 at 16:08 UTC 5d215a7b3eb0a9a69c0cb9aa43dcae956a0aa03e
21 files changed +34 -39
archive.c
+1 -1
@@ -760,7 +760,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
760 const char **argv_copy;
761 int rc;
762
763 - git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
763 + repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
764 repo_config(the_repository, git_default_config, NULL);
765
766 describe_status.max_invocations = 1;
builtin/am.c
+4 -4
@@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)
162
163 state->prec = 4;
164
165 - git_config_get_bool("am.threeway", &state->threeway);
165 + repo_config_get_bool(the_repository, "am.threeway", &state->threeway);
166
167 state->utf8 = 1;
168
169 - git_config_get_bool("am.messageid", &state->message_id);
169 + repo_config_get_bool(the_repository, "am.messageid", &state->message_id);
170
171 state->scissors = SCISSORS_UNSET;
172 state->quoted_cr = quoted_cr_unset;
173
174 strvec_init(&state->git_apply_opts);
175
176 - if (!git_config_get_bool("commit.gpgsign", &gpgsign))
176 + if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign))
177 state->sign_commit = gpgsign ? "" : NULL;
178 }
179
@@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
965 {
966 if (keep_cr < 0) {
967 keep_cr = 0;
968 - git_config_get_bool("am.keepcr", &keep_cr);
968 + repo_config_get_bool(the_repository, "am.keepcr", &keep_cr);
969 }
970
971 switch (patch_format) {
builtin/checkout.c
+1 -1
@@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,
291 read_mmblob(&ours, &threeway[1]);
292 read_mmblob(&theirs, &threeway[2]);
293
294 - git_config_get_bool("merge.renormalize", &renormalize);
294 + repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
295 ll_opts.renormalize = renormalize;
296 ll_opts.conflict_style = conflict_style;
297 merge_status = ll_merge(&result_buf, path, &ancestor, "base",
builtin/clone.c
+1 -1
@@ -1150,7 +1150,7 @@ int cmd_clone(int argc,
1150 strbuf_reset(&sb);
1151 }
1152
1153 - if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
1153 + if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) &&
1154 val)
1155 string_list_append(&option_config, "submodule.recurse=true");
1156
builtin/credential-cache--daemon.c
+1 -1
@@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,
307 OPT_END()
308 };
309
310 - git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
310 + repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup);
311
312 argc = parse_options(argc, argv, prefix, options, usage, 0);
313 socket_path = argv[0];
builtin/gc.c
+3 -3
@@ -193,8 +193,8 @@ static void gc_config(struct gc_config *cfg)
193 repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
194 repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
195 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);
198 repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
199
200 if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
@@ -1779,7 +1779,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
1779 strbuf_reset(&config_name);
1780 strbuf_addf(&config_name, "maintenance.%s.enabled",
1781 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))
1783 strategy.tasks[i].enabled = config_value;
1784 if (!strategy.tasks[i].enabled)
1785 continue;
builtin/grep.c
+1 -1
@@ -1058,7 +1058,7 @@ int cmd_grep(int argc,
1058
1059 if (use_index && !startup_info->have_repository) {
1060 int fallback = 0;
1061 - git_config_get_bool("grep.fallbacktonoindex", &fallback);
1061 + repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
1062 if (fallback)
1063 use_index = 0;
1064 else
builtin/rebase.c
+1 -1
@@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)
340 unsigned flags = 0;
341 int abbreviate_commands = 0, ret = 0;
342
343 - git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands);
343 + repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands);
344
345 flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
346 flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
compat/precompose_utf8.c
+1 -1
@@ -75,7 +75,7 @@ const char *precompose_string_if_needed(const char *in)
75 iconv_t ic_prec;
76 char *out;
77 if (precomposed_unicode < 0)
78 - git_config_get_bool("core.precomposeunicode", &precomposed_unicode);
78 + repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode);
79 if (precomposed_unicode != 1)
80 return in;
81 ic_prec = iconv_open(repo_encoding, path_encoding);
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_bool(const char *key, int *dest)
723 -{
724 - return repo_config_get_bool(the_repository, key, dest);
725 -}
726 -
722 static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest)
723 {
724 return repo_config_get_bool_or_int(the_repository, key, is_bool, dest);
daemon.c
+1 -1
@@ -402,7 +402,7 @@ static int run_service(const char *dir, struct daemon_service *service,
402
403 if (service->overridable) {
404 strbuf_addf(&var, "daemon.%s", service->config_name);
405 - git_config_get_bool(var.buf, &enabled);
405 + repo_config_get_bool(the_repository, var.buf, &enabled);
406 strbuf_release(&var);
407 }
408 if (!enabled) {
fetch-pack.c
+4 -4
@@ -1903,10 +1903,10 @@ static void fetch_pack_config(void)
1903 {
1904 repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit);
1905 repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit);
1906 - git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta);
1907 - git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects);
1908 - git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
1909 - git_config_get_bool("transfer.advertisesid", &advertise_sid);
1906 + repo_config_get_bool(the_repository, "repack.usedeltabaseoffset", &prefer_ofs_delta);
1907 + repo_config_get_bool(the_repository, "fetch.fsckobjects", &fetch_fsck_objects);
1908 + repo_config_get_bool(the_repository, "transfer.fsckobjects", &transfer_fsck_objects);
1909 + repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
1910 if (!uri_protocols.nr) {
1911 char *str;
1912
http-backend.c
+2 -2
@@ -246,13 +246,13 @@ static void http_config(void)
246 int i, value = 0;
247 struct strbuf var = STRBUF_INIT;
248
249 - git_config_get_bool("http.getanyfile", &getanyfile);
249 + repo_config_get_bool(the_repository, "http.getanyfile", &getanyfile);
250 repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
251
252 for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
253 struct rpc_service *svc = &rpc_service[i];
254 strbuf_addf(&var, "http.%s", svc->config_name);
255 - if (!git_config_get_bool(var.buf, &value))
255 + if (!repo_config_get_bool(the_repository, var.buf, &value))
256 svc->enabled = value;
257 strbuf_reset(&var);
258 }
merge-ort.c
+1 -1
@@ -5356,7 +5356,7 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
5356 repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity);
5357 repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit);
5358 repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit);
5359 - git_config_get_bool("merge.renormalize", &renormalize);
5359 + repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
5360 opt->renormalize = renormalize;
5361 if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
5362 opt->detect_renames = git_config_rename("diff.renames", value);
promisor-remote.c
+2 -2
@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo,
46 "fetch", remote_name, "--no-tags",
47 "--no-write-fetch-head", "--recurse-submodules=no",
48 "--filter=blob:none", "--stdin", NULL);
49 - if (!git_config_get_bool("promisor.quiet", &quiet) && quiet)
49 + if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet)
50 strvec_push(&child.args, "--quiet");
51 if (start_command(&child))
52 die(_("promisor-remote: unable to fork off fetch subprocess"));
@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo)
343 struct strvec names = STRVEC_INIT;
344 struct strvec urls = STRVEC_INIT;
345
346 - git_config_get_bool("promisor.advertise", &advertise_promisors);
346 + repo_config_get_bool(the_repository, "promisor.advertise", &advertise_promisors);
347
348 if (!advertise_promisors)
349 return NULL;
read-cache.c
+2 -2
@@ -2755,7 +2755,7 @@ static int record_eoie(void)
2755 {
2756 int val;
2757
2758 - if (!git_config_get_bool("index.recordendofindexentries", &val))
2758 + if (!repo_config_get_bool(the_repository, "index.recordendofindexentries", &val))
2759 return val;
2760
2761 /*
@@ -2770,7 +2770,7 @@ static int record_ieot(void)
2770 {
2771 int val;
2772
2773 - if (!git_config_get_bool("index.recordoffsettable", &val))
2773 + if (!repo_config_get_bool(the_repository, "index.recordoffsettable", &val))
2774 return val;
2775
2776 /*
rerere.c
+2 -2
@@ -877,8 +877,8 @@ static int do_plain_rerere(struct repository *r,
877
878 static void git_rerere_config(void)
879 {
880 - git_config_get_bool("rerere.enabled", &rerere_enabled);
881 - git_config_get_bool("rerere.autoupdate", &rerere_autoupdate);
880 + repo_config_get_bool(the_repository, "rerere.enabled", &rerere_enabled);
881 + repo_config_get_bool(the_repository, "rerere.autoupdate", &rerere_autoupdate);
882 repo_config(the_repository, git_default_config, NULL);
883 }
884
run-command.c
+3 -3
@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
1817 {
1818 int enabled, auto_detach;
1819
1820 - if (!git_config_get_bool("maintenance.auto", &enabled) &&
1820 + if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) &&
1821 !enabled)
1822 return 0;
1823
@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint)
1826 * honoring `gc.autoDetach`. This is somewhat weird, but required to
1827 * retain behaviour from when we used to run git-gc(1) here.
1828 */
1829 - if (git_config_get_bool("maintenance.autodetach", &auto_detach) &&
1830 - git_config_get_bool("gc.autodetach", &auto_detach))
1829 + if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&
1830 + repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach))
1831 auto_detach = 1;
1832
1833 maint->git_cmd = 1;
setup.c
+1 -1
@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
1877 * the core.precomposeunicode configuration, this
1878 * has to happen after the above block that finds
1879 * out where the repository is, i.e. a preparation
1880 - * for calling git_config_get_bool().
1880 + * for calling repo_config_get_bool().
1881 */
1882 if (prefix) {
1883 prefix = precompose_string_if_needed(prefix);
t/helper/test-config.c
+1 -1
@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv)
163 goto exit1;
164 }
165 } else if (argc == 3 && !strcmp(argv[1], "get_bool")) {
166 - if (!git_config_get_bool(argv[2], &val)) {
166 + if (!repo_config_get_bool(the_repository, argv[2], &val)) {
167 printf("%d\n", val);
168 goto exit0;
169 } else {
transport.c
+1 -1
@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport)
1602 * Don't request bundle-uri from the server unless configured to
1603 * do so by the transfer.bundleURI=true config option.
1604 */
1605 - if (git_config_get_bool("transfer.bundleuri", &value) || !value)
1605 + if (repo_config_get_bool(the_repository, "transfer.bundleuri", &value) || !value)
1606 return 0;
1607
1608 if (!transport->bundles->baseURI)