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>

Patrick Steinhardt committed Jul 23, 2025 at 16:08 UTC 3fda14d86d91c665e3d7c50da242cc4ddd63eea5
13 files changed +31 -36
builtin/credential-store.c
+1 -1
@@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
66 {
67 int timeout_ms = 1000;
68
69 - git_config_get_int("credentialstore.locktimeoutms", &timeout_ms);
69 + repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms);
70 if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
71 die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
72 if (extra)
builtin/fast-import.c
+3 -3
@@ -3527,7 +3527,7 @@ static void git_pack_config(void)
3527 if (max_depth > MAX_DEPTH)
3528 max_depth = MAX_DEPTH;
3529 }
3530 - if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
3530 + if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) {
3531 pack_idx_opts.version = indexversion_value;
3532 if (pack_idx_opts.version > 2)
3533 git_die_config(the_repository, "pack.indexversion",
@@ -3536,9 +3536,9 @@ static void git_pack_config(void)
3536 if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
3537 max_packsize = packsizelimit_value;
3538
3539 - if (!git_config_get_int("fastimport.unpacklimit", &limit))
3539 + if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
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 unpack_limit = limit;
3543
3544 repo_config(the_repository, git_default_config, NULL);
builtin/fetch.c
+2 -2
@@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,
2683 * but respect config settings disabling it.
2684 */
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 opt_val = -1;
2688 if (opt_val != 0)
2689 git_config_push_parameter("gc.autoPackLimit=1");
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 opt_val = -1;
2693 if (opt_val != 0)
2694 git_config_push_parameter("maintenance.incremental-repack.auto=-1");
builtin/gc.c
+13 -13
@@ -189,10 +189,10 @@ static void gc_config(struct gc_config *cfg)
189 gc_config_is_timestamp_never("gc.reflogexpireunreachable"))
190 cfg->prune_reflogs = 0;
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 git_config_get_bool("gc.autodetach", &cfg->detach_auto);
197 git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
198 git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
@@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)
332 };
333 int limit = 100;
334
335 - git_config_get_int("maintenance.reflog-expire.auto", &limit);
335 + repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit);
336 if (!limit)
337 return 0;
338 if (limit < 0)
@@ -378,7 +378,7 @@ static int worktree_prune_condition(struct gc_config *cfg)
378 struct dirent *d;
379 DIR *dir = NULL;
380
381 - git_config_get_int("maintenance.worktree-prune.auto", &limit);
381 + repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit);
382 if (limit <= 0) {
383 should_prune = limit < 0;
384 goto out;
@@ -423,7 +423,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)
423 int should_gc = 0, limit = 1;
424 DIR *dir = NULL;
425
426 - git_config_get_int("maintenance.rerere-gc.auto", &limit);
426 + repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit);
427 if (limit <= 0) {
428 should_gc = limit < 0;
429 goto out;
@@ -1161,8 +1161,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)
1161
1162 data.num_not_in_graph = 0;
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
1167 if (!data.limit)
1168 return 0;
@@ -1300,8 +1300,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)
1300 {
1301 int count = 0;
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
1306 if (!loose_object_auto_limit)
1307 return 0;
@@ -1415,8 +1415,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)
1415 if (!the_repository->settings.core_multi_pack_index)
1416 return 0;
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
1421 if (!incremental_repack_auto_limit)
1422 return 0;
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_int(const char *key, int *dest)
723 -{
724 - return repo_config_get_int(the_repository, key, dest);
725 -}
726 -
722 static inline int git_config_get_ulong(const char *key, unsigned long *dest)
723 {
724 return repo_config_get_ulong(the_repository, key, dest);
fetch-pack.c
+2 -2
@@ -1901,8 +1901,8 @@ static int fetch_pack_config_cb(const char *var, const char *value,
1901
1902 static void fetch_pack_config(void)
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 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);
fsmonitor.c
+1 -1
@@ -43,7 +43,7 @@ static int fsmonitor_hook_version(void)
43 {
44 int hook_version;
45
46 - if (git_config_get_int("core.fsmonitorhookversion", &hook_version))
46 + if (repo_config_get_int(the_repository, "core.fsmonitorhookversion", &hook_version))
47 return -1;
48
49 if (hook_version == HOOK_INTERFACE_VERSION1 ||
merge-ort.c
+3 -3
@@ -5353,9 +5353,9 @@ static void merge_recursive_config(struct merge_options *opt, int ui)
5353 {
5354 char *value = NULL;
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 git_config_get_bool("merge.renormalize", &renormalize);
5360 opt->renormalize = renormalize;
5361 if (!repo_config_get_string(the_repository, "diff.renames", &value)) {
parallel-checkout.c
+2 -2
@@ -57,12 +57,12 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)
57 return;
58 }
59
60 - if (git_config_get_int("checkout.workers", num_workers))
60 + if (repo_config_get_int(the_repository, "checkout.workers", num_workers))
61 *num_workers = DEFAULT_NUM_WORKERS;
62 else if (*num_workers < 1)
63 *num_workers = online_cpus();
64
65 - if (git_config_get_int("checkout.thresholdForParallelism", threshold))
65 + if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold))
66 *threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM;
67 }
68
refs.c
+1 -1
@@ -945,7 +945,7 @@ long get_files_ref_lock_timeout_ms(void)
945 static int timeout_ms = 100;
946
947 if (!configured) {
948 - git_config_get_int("core.filesreflocktimeout", &timeout_ms);
948 + repo_config_get_int(the_repository, "core.filesreflocktimeout", &timeout_ms);
949 configured = 1;
950 }
951
refs/packed-backend.c
+1 -1
@@ -1228,7 +1228,7 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)
1228 static int timeout_value = 1000;
1229
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 timeout_configured = 1;
1233 }
1234
sequencer.c
+1 -1
@@ -5834,7 +5834,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
5834 *cmd_reset = abbr ? "t" : "reset",
5835 *cmd_merge = abbr ? "m" : "merge";
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
5839 oidmap_init(&commit2todo, 0);
5840 oidmap_init(&state.commit2label, 0);
t/helper/test-config.c
+1 -1
@@ -155,7 +155,7 @@ int cmd__config(int argc, const char **argv)
155 BUG("Key \"%s\" has unknown return %d", argv[2], ret);
156 goto exit1;
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 printf("%d\n", val);
160 goto exit0;
161 } else {