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 committedJul 23, 2025 at 16:08 UTC5d215a7b3eb0a9a69c0cb9aa43dcae956a0aa03e
index a9c877d9cf..08b0da8962 100644--- a/promisor-remote.c+++ b/promisor-remote.c@@ -46,7 +46,7 @@ static int fetch_objects(struct repository *repo, "fetch", remote_name, "--no-tags", "--no-write-fetch-head", "--recurse-submodules=no", "--filter=blob:none", "--stdin", NULL);- if (!git_config_get_bool("promisor.quiet", &quiet) && quiet)+ if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet) strvec_push(&child.args, "--quiet"); if (start_command(&child)) die(_("promisor-remote: unable to fork off fetch subprocess"));@@ -343,7 +343,7 @@ char *promisor_remote_info(struct repository *repo) struct strvec names = STRVEC_INIT; struct strvec urls = STRVEC_INIT;- git_config_get_bool("promisor.advertise", &advertise_promisors);+ repo_config_get_bool(the_repository, "promisor.advertise", &advertise_promisors); if (!advertise_promisors) return NULL;
read-cache.c
+2-2
index 5cf41b81f1..4fdde758d1 100644--- a/read-cache.c+++ b/read-cache.c@@ -2755,7 +2755,7 @@ static int record_eoie(void) { int val;- if (!git_config_get_bool("index.recordendofindexentries", &val))+ if (!repo_config_get_bool(the_repository, "index.recordendofindexentries", &val)) return val; /*@@ -2770,7 +2770,7 @@ static int record_ieot(void) { int val;- if (!git_config_get_bool("index.recordoffsettable", &val))+ if (!repo_config_get_bool(the_repository, "index.recordoffsettable", &val)) return val; /*
index 8833b23367..ed9575bd6a 100644--- a/run-command.c+++ b/run-command.c@@ -1817,7 +1817,7 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint) { int enabled, auto_detach;- if (!git_config_get_bool("maintenance.auto", &enabled) &&+ if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) && !enabled) return 0;@@ -1826,8 +1826,8 @@ int prepare_auto_maintenance(int quiet, struct child_process *maint) * honoring `gc.autoDetach`. This is somewhat weird, but required to * retain behaviour from when we used to run git-gc(1) here. */- if (git_config_get_bool("maintenance.autodetach", &auto_detach) &&- git_config_get_bool("gc.autodetach", &auto_detach))+ if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) &&+ repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach)) auto_detach = 1; maint->git_cmd = 1;
setup.c
+1-1
index 9661c5d5d5..a06bb921b3 100644--- a/setup.c+++ b/setup.c@@ -1877,7 +1877,7 @@ const char *setup_git_directory_gently(int *nongit_ok) * the core.precomposeunicode configuration, this * has to happen after the above block that finds * out where the repository is, i.e. a preparation- * for calling git_config_get_bool().+ * for calling repo_config_get_bool(). */ if (prefix) { prefix = precompose_string_if_needed(prefix);
t/helper/test-config.c
+1-1
index ce1e333051..9f8cca7c48 100644--- a/t/helper/test-config.c+++ b/t/helper/test-config.c@@ -163,7 +163,7 @@ int cmd__config(int argc, const char **argv) goto exit1; } } else if (argc == 3 && !strcmp(argv[1], "get_bool")) {- if (!git_config_get_bool(argv[2], &val)) {+ if (!repo_config_get_bool(the_repository, argv[2], &val)) { printf("%d\n", val); goto exit0; } else {
transport.c
+1-1
index 89e6297ce2..e305d6bd22 100644--- a/transport.c+++ b/transport.c@@ -1602,7 +1602,7 @@ int transport_get_remote_bundle_uri(struct transport *transport) * Don't request bundle-uri from the server unless configured to * do so by the transfer.bundleURI=true config option. */- if (git_config_get_bool("transfer.bundleuri", &value) || !value)+ if (repo_config_get_bool(the_repository, "transfer.bundleuri", &value) || !value) return 0; if (!transport->bundles->baseURI)