Skip to content

Commit d57f078

Browse files
pks-tgitster
authored andcommitted
config: drop git_config_get_ulong() wrapper
In 036876a (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_ulong()`. All callsites are adjusted so that they use `repo_config_get_ulong(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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3fda14d commit d57f078

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

builtin/fast-import.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,7 +3523,7 @@ static void git_pack_config(void)
35233523
int limit;
35243524
unsigned long packsizelimit_value;
35253525

3526-
if (!git_config_get_ulong("pack.depth", &max_depth)) {
3526+
if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) {
35273527
if (max_depth > MAX_DEPTH)
35283528
max_depth = MAX_DEPTH;
35293529
}
@@ -3533,7 +3533,7 @@ static void git_pack_config(void)
35333533
git_die_config(the_repository, "pack.indexversion",
35343534
"bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
35353535
}
3536-
if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
3536+
if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value))
35373537
max_packsize = packsizelimit_value;
35383538

35393539
if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))

builtin/gc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)
195195
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
196196
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
197197
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
198-
git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
198+
repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
199199

200200
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
201201
free(cfg->prune_expire);
@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)
212212
cfg->gc_log_expire = owned;
213213
}
214214

215-
git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
216-
git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
215+
repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
216+
repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
217217

218-
if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
218+
if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
219219
cfg->delta_base_cache_limit = ulongval;
220220

221221
if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
@@ -2344,7 +2344,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
23442344
die(_("failed to create directories for '%s'"), filename);
23452345

23462346
if ((long)lock_file_timeout_ms < 0 &&
2347-
git_config_get_ulong("gc.launchctlplistlocktimeoutms",
2347+
repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms",
23482348
&lock_file_timeout_ms))
23492349
lock_file_timeout_ms = 150;
23502350

config.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
719719
int lookup_config(const char **mapping, int nr_mapping, const char *var);
720720

721721
# ifdef USE_THE_REPOSITORY_VARIABLE
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);
725-
}
726-
727722
static inline int git_config_get_bool(const char *key, int *dest)
728723
{
729724
return repo_config_get_bool(the_repository, key, dest);

http-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static void http_config(void)
247247
struct strbuf var = STRBUF_INIT;
248248

249249
git_config_get_bool("http.getanyfile", &getanyfile);
250-
git_config_get_ulong("http.maxrequestbuffer", &max_request_buffer);
250+
repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
251251

252252
for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
253253
struct rpc_service *svc = &rpc_service[i];

0 commit comments

Comments
 (0)