git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 10/21] config: drop `git_config_get_ulong()` wrapper

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 17, 2025, 10:49 UTC
Message-ID
<20250717-pks-config-wo-the-repository-v1-10-d888e4a17de1@pks.im>
In-Reply-To
<20250717-pks-config-wo-the-repository-v1-0-d888e4a17de1@pks.im>

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_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 <ps@pks.im>
---
 builtin/fast-import.c |  4 ++--
 builtin/gc.c          | 10 +++++-----
 config.h              |  5 -----
 http-backend.c        |  2 +-
 4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 9b0ae437148..a3f7f14f4fe 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3523,7 +3523,7 @@ static void git_pack_config(void)
 	int limit;
 	unsigned long packsizelimit_value;
 
-	if (!git_config_get_ulong("pack.depth", &max_depth)) {
+	if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) {
 		if (max_depth > MAX_DEPTH)
 			max_depth = MAX_DEPTH;
 	}
@@ -3533,7 +3533,7 @@ static void git_pack_config(void)
 			git_die_config(the_repository, "pack.indexversion",
 				       "bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
 	}
-	if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
+	if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value))
 		max_packsize = packsizelimit_value;
 
 	if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
diff --git a/builtin/gc.c b/builtin/gc.c
index cf175b8f1b7..d15daf59625 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -195,7 +195,7 @@ static void gc_config(struct gc_config *cfg)
 	repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
 	git_config_get_bool("gc.autodetach", &cfg->detach_auto);
 	git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
-	git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
+	repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
 
 	if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
 		free(cfg->prune_expire);
@@ -212,10 +212,10 @@ static void gc_config(struct gc_config *cfg)
 		cfg->gc_log_expire = owned;
 	}
 
-	git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
-	git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
+	repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
+	repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
 
-	if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
+	if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
 		cfg->delta_base_cache_limit = ulongval;
 
 	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
 		die(_("failed to create directories for '%s'"), filename);
 
 	if ((long)lock_file_timeout_ms < 0 &&
-	    git_config_get_ulong("gc.launchctlplistlocktimeoutms",
+	    repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms",
 				 &lock_file_timeout_ms))
 		lock_file_timeout_ms = 150;
 
diff --git a/config.h b/config.h
index 2490c47daaf..e22c07a4488 100644
--- a/config.h
+++ b/config.h
@@ -719,11 +719,6 @@ NORETURN void git_die_config_linenr(const char *key, const char *filename, int l
 int lookup_config(const char **mapping, int nr_mapping, const char *var);
 
 # ifdef USE_THE_REPOSITORY_VARIABLE
-static inline int git_config_get_ulong(const char *key, unsigned long *dest)
-{
-	return repo_config_get_ulong(the_repository, key, dest);
-}
-
 static inline int git_config_get_bool(const char *key, int *dest)
 {
 	return repo_config_get_bool(the_repository, key, dest);
diff --git a/http-backend.c b/http-backend.c
index ad8c4037493..3d5d5a84646 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -247,7 +247,7 @@ static void http_config(void)
 	struct strbuf var = STRBUF_INIT;
 
 	git_config_get_bool("http.getanyfile", &getanyfile);
-	git_config_get_ulong("http.maxrequestbuffer", &max_request_buffer);
+	repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer);
 
 	for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
 		struct rpc_service *svc = &rpc_service[i];
-- 
2.50.1.465.gcb3da1c9e6.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 11 of 48 in “config: remove use of `the_repository`”
  1. 00/21 config: remove use of `the_repository`Patrick Steinhardt, Jul 17, 2025
  2. 01/21 config: drop `git_config()` wrapperPatrick Steinhardt, Jul 17, 2025
  3. 02/21 config: drop `git_config_clear()` wrapperPatrick Steinhardt, Jul 17, 2025
  4. 03/21 config: drop `git_config_get()` wrapperPatrick Steinhardt, Jul 17, 2025
  5. 04/21 config: drop `git_config_get_value()` wrapperPatrick Steinhardt, Jul 17, 2025
  6. 05/21 config: drop `git_config_get_value()` wrapperPatrick Steinhardt, Jul 17, 2025
  7. 06/21 config: drop `git_config_get_string_multi()` wrapperPatrick Steinhardt, Jul 17, 2025
  8. 07/21 config: drop `git_config_get_string()` wrapperPatrick Steinhardt, Jul 17, 2025
  9. 08/21 config: drop `git_config_get_string()` wrapperPatrick Steinhardt, Jul 17, 2025
  10. 09/21 config: drop `git_config_get_int()` wrapperPatrick Steinhardt, Jul 17, 2025
  11. 10/21 config: drop `git_config_get_ulong()` wrapperPatrick Steinhardt, Jul 17, 2025
  12. 11/21 config: drop `git_config_get_bool()` wrapperPatrick Steinhardt, Jul 17, 2025
  13. 12/21 config: drop `git_config_set_in_file()` wrapperPatrick Steinhardt, Jul 17, 2025
  14. 13/21 config: drop `git_config_set_gently()` wrapperPatrick Steinhardt, Jul 17, 2025
  15. 14/21 config: drop `git_config_set()` wrapperPatrick Steinhardt, Jul 17, 2025
  16. 15/21 config: drop `git_config_set_in_file_gently()` wrapperPatrick Steinhardt, Jul 17, 2025
  17. 16/21 config: drop `git_config_set_multivar_in_file_gently()` wrapperPatrick Steinhardt, Jul 17, 2025
  18. 17/21 config: drop `git_config_get_multivar_gently()` wrapperPatrick Steinhardt, Jul 17, 2025
  19. 18/21 config: drop `git_config_set_multivar()` wrapperPatrick Steinhardt, Jul 17, 2025
  20. 19/21 config: remove unused `the_repository` wrappersPatrick Steinhardt, Jul 17, 2025
  21. 20/21 config: move Git config parsing into "environment.c"Patrick Steinhardt, Jul 17, 2025
  22. 21/21 config: fix sign comparison warningsPatrick Steinhardt, Jul 17, 2025
  23. Phillip WoodJul 23, 2025
  24. Patrick SteinhardtJul 23, 2025
  25. 00/21 config: remove use of `the_repository`Patrick Steinhardt, Jul 23, 2025
  26. 01/21 config: drop `git_config()` wrapperPatrick Steinhardt, Jul 23, 2025
  27. 02/21 config: drop `git_config_clear()` wrapperPatrick Steinhardt, Jul 23, 2025
  28. 03/21 config: drop `git_config_get()` wrapperPatrick Steinhardt, Jul 23, 2025
  29. 04/21 config: drop `git_config_get_value()` wrapperPatrick Steinhardt, Jul 23, 2025
  30. 05/21 config: drop `git_config_get_value()` wrapperPatrick Steinhardt, Jul 23, 2025
  31. 06/21 config: drop `git_config_get_string_multi()` wrapperPatrick Steinhardt, Jul 23, 2025
  32. 07/21 config: drop `git_config_get_string()` wrapperPatrick Steinhardt, Jul 23, 2025
  33. 08/21 config: drop `git_config_get_string()` wrapperPatrick Steinhardt, Jul 23, 2025
  34. 09/21 config: drop `git_config_get_int()` wrapperPatrick Steinhardt, Jul 23, 2025
  35. 10/21 config: drop `git_config_get_ulong()` wrapperPatrick Steinhardt, Jul 23, 2025
  36. 11/21 config: drop `git_config_get_bool()` wrapperPatrick Steinhardt, Jul 23, 2025
  37. 12/21 config: drop `git_config_set_in_file()` wrapperPatrick Steinhardt, Jul 23, 2025
  38. 13/21 config: drop `git_config_set_gently()` wrapperPatrick Steinhardt, Jul 23, 2025
  39. 14/21 config: drop `git_config_set()` wrapperPatrick Steinhardt, Jul 23, 2025
  40. 15/21 config: drop `git_config_set_in_file_gently()` wrapperPatrick Steinhardt, Jul 23, 2025
  41. 16/21 config: drop `git_config_set_multivar_in_file_gently()` wrapperPatrick Steinhardt, Jul 23, 2025
  42. 17/21 config: drop `git_config_get_multivar_gently()` wrapperPatrick Steinhardt, Jul 23, 2025
  43. 18/21 config: drop `git_config_set_multivar()` wrapperPatrick Steinhardt, Jul 23, 2025
  44. 19/21 config: remove unused `the_repository` wrappersPatrick Steinhardt, Jul 23, 2025
  45. 20/21 config: move Git config parsing into "environment.c"Patrick Steinhardt, Jul 23, 2025
  46. 21/21 config: fix sign comparison warningsPatrick Steinhardt, Jul 23, 2025
  47. Phillip WoodJul 23, 2025
  48. Junio C HamanoJul 23, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.