Git fork

config: drop `git_config_get_int()` 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_int()`. All
callsites are adjusted so that they use
`repo_config_get_int(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
3fda14d8 cba3c025

+31 -36
+1 -1
builtin/credential-store.c
··· 66 66 { 67 67 int timeout_ms = 1000; 68 68 69 - git_config_get_int("credentialstore.locktimeoutms", &timeout_ms); 69 + repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms); 70 70 if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0) 71 71 die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms); 72 72 if (extra)
+3 -3
builtin/fast-import.c
··· 3527 3527 if (max_depth > MAX_DEPTH) 3528 3528 max_depth = MAX_DEPTH; 3529 3529 } 3530 - if (!git_config_get_int("pack.indexversion", &indexversion_value)) { 3530 + if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) { 3531 3531 pack_idx_opts.version = indexversion_value; 3532 3532 if (pack_idx_opts.version > 2) 3533 3533 git_die_config(the_repository, "pack.indexversion", ··· 3536 3536 if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value)) 3537 3537 max_packsize = packsizelimit_value; 3538 3538 3539 - if (!git_config_get_int("fastimport.unpacklimit", &limit)) 3539 + if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit)) 3540 3540 unpack_limit = limit; 3541 - else if (!git_config_get_int("transfer.unpacklimit", &limit)) 3541 + else if (!repo_config_get_int(the_repository, "transfer.unpacklimit", &limit)) 3542 3542 unpack_limit = limit; 3543 3543 3544 3544 repo_config(the_repository, git_default_config, NULL);
+2 -2
builtin/fetch.c
··· 2683 2683 * but respect config settings disabling it. 2684 2684 */ 2685 2685 int opt_val; 2686 - if (git_config_get_int("gc.autopacklimit", &opt_val)) 2686 + if (repo_config_get_int(the_repository, "gc.autopacklimit", &opt_val)) 2687 2687 opt_val = -1; 2688 2688 if (opt_val != 0) 2689 2689 git_config_push_parameter("gc.autoPackLimit=1"); 2690 2690 2691 - if (git_config_get_int("maintenance.incremental-repack.auto", &opt_val)) 2691 + if (repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", &opt_val)) 2692 2692 opt_val = -1; 2693 2693 if (opt_val != 0) 2694 2694 git_config_push_parameter("maintenance.incremental-repack.auto=-1");
+13 -13
builtin/gc.c
··· 189 189 gc_config_is_timestamp_never("gc.reflogexpireunreachable")) 190 190 cfg->prune_reflogs = 0; 191 191 192 - git_config_get_int("gc.aggressivewindow", &cfg->aggressive_window); 193 - git_config_get_int("gc.aggressivedepth", &cfg->aggressive_depth); 194 - git_config_get_int("gc.auto", &cfg->gc_auto_threshold); 195 - git_config_get_int("gc.autopacklimit", &cfg->gc_auto_pack_limit); 192 + repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window); 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 196 git_config_get_bool("gc.autodetach", &cfg->detach_auto); 197 197 git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs); 198 198 git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size); ··· 332 332 }; 333 333 int limit = 100; 334 334 335 - git_config_get_int("maintenance.reflog-expire.auto", &limit); 335 + repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit); 336 336 if (!limit) 337 337 return 0; 338 338 if (limit < 0) ··· 378 378 struct dirent *d; 379 379 DIR *dir = NULL; 380 380 381 - git_config_get_int("maintenance.worktree-prune.auto", &limit); 381 + repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit); 382 382 if (limit <= 0) { 383 383 should_prune = limit < 0; 384 384 goto out; ··· 423 423 int should_gc = 0, limit = 1; 424 424 DIR *dir = NULL; 425 425 426 - git_config_get_int("maintenance.rerere-gc.auto", &limit); 426 + repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit); 427 427 if (limit <= 0) { 428 428 should_gc = limit < 0; 429 429 goto out; ··· 1161 1161 1162 1162 data.num_not_in_graph = 0; 1163 1163 data.limit = 100; 1164 - git_config_get_int("maintenance.commit-graph.auto", 1165 - &data.limit); 1164 + repo_config_get_int(the_repository, "maintenance.commit-graph.auto", 1165 + &data.limit); 1166 1166 1167 1167 if (!data.limit) 1168 1168 return 0; ··· 1300 1300 { 1301 1301 int count = 0; 1302 1302 1303 - git_config_get_int("maintenance.loose-objects.auto", 1304 - &loose_object_auto_limit); 1303 + repo_config_get_int(the_repository, "maintenance.loose-objects.auto", 1304 + &loose_object_auto_limit); 1305 1305 1306 1306 if (!loose_object_auto_limit) 1307 1307 return 0; ··· 1415 1415 if (!the_repository->settings.core_multi_pack_index) 1416 1416 return 0; 1417 1417 1418 - git_config_get_int("maintenance.incremental-repack.auto", 1419 - &incremental_repack_auto_limit); 1418 + repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", 1419 + &incremental_repack_auto_limit); 1420 1420 1421 1421 if (!incremental_repack_auto_limit) 1422 1422 return 0;
-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_int(const char *key, int *dest) 723 - { 724 - return repo_config_get_int(the_repository, key, dest); 725 - } 726 - 727 722 static inline int git_config_get_ulong(const char *key, unsigned long *dest) 728 723 { 729 724 return repo_config_get_ulong(the_repository, key, dest);
+2 -2
fetch-pack.c
··· 1901 1901 1902 1902 static void fetch_pack_config(void) 1903 1903 { 1904 - git_config_get_int("fetch.unpacklimit", &fetch_unpack_limit); 1905 - git_config_get_int("transfer.unpacklimit", &transfer_unpack_limit); 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 1906 git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta); 1907 1907 git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects); 1908 1908 git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects);
+1 -1
fsmonitor.c
··· 43 43 { 44 44 int hook_version; 45 45 46 - if (git_config_get_int("core.fsmonitorhookversion", &hook_version)) 46 + if (repo_config_get_int(the_repository, "core.fsmonitorhookversion", &hook_version)) 47 47 return -1; 48 48 49 49 if (hook_version == HOOK_INTERFACE_VERSION1 ||
+3 -3
merge-ort.c
··· 5353 5353 { 5354 5354 char *value = NULL; 5355 5355 int renormalize = 0; 5356 - git_config_get_int("merge.verbosity", &opt->verbosity); 5357 - git_config_get_int("diff.renamelimit", &opt->rename_limit); 5358 - git_config_get_int("merge.renamelimit", &opt->rename_limit); 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 5359 git_config_get_bool("merge.renormalize", &renormalize); 5360 5360 opt->renormalize = renormalize; 5361 5361 if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
+2 -2
parallel-checkout.c
··· 57 57 return; 58 58 } 59 59 60 - if (git_config_get_int("checkout.workers", num_workers)) 60 + if (repo_config_get_int(the_repository, "checkout.workers", num_workers)) 61 61 *num_workers = DEFAULT_NUM_WORKERS; 62 62 else if (*num_workers < 1) 63 63 *num_workers = online_cpus(); 64 64 65 - if (git_config_get_int("checkout.thresholdForParallelism", threshold)) 65 + if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold)) 66 66 *threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM; 67 67 } 68 68
+1 -1
refs.c
··· 945 945 static int timeout_ms = 100; 946 946 947 947 if (!configured) { 948 - git_config_get_int("core.filesreflocktimeout", &timeout_ms); 948 + repo_config_get_int(the_repository, "core.filesreflocktimeout", &timeout_ms); 949 949 configured = 1; 950 950 } 951 951
+1 -1
refs/packed-backend.c
··· 1228 1228 static int timeout_value = 1000; 1229 1229 1230 1230 if (!timeout_configured) { 1231 - git_config_get_int("core.packedrefstimeout", &timeout_value); 1231 + repo_config_get_int(the_repository, "core.packedrefstimeout", &timeout_value); 1232 1232 timeout_configured = 1; 1233 1233 } 1234 1234
+1 -1
sequencer.c
··· 5834 5834 *cmd_reset = abbr ? "t" : "reset", 5835 5835 *cmd_merge = abbr ? "m" : "merge"; 5836 5836 5837 - git_config_get_int("rebase.maxlabellength", &state.max_label_length); 5837 + repo_config_get_int(the_repository, "rebase.maxlabellength", &state.max_label_length); 5838 5838 5839 5839 oidmap_init(&commit2todo, 0); 5840 5840 oidmap_init(&state.commit2label, 0);
+1 -1
t/helper/test-config.c
··· 155 155 BUG("Key \"%s\" has unknown return %d", argv[2], ret); 156 156 goto exit1; 157 157 } else if (argc == 3 && !strcmp(argv[1], "get_int")) { 158 - if (!git_config_get_int(argv[2], &val)) { 158 + if (!repo_config_get_int(the_repository, argv[2], &val)) { 159 159 printf("%d\n", val); 160 160 goto exit0; 161 161 } else {