Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
5d215a7b d57f078e

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