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

[PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 17, 2025, 10:49 UTC
Message-ID
<20250717-pks-config-wo-the-repository-v1-6-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_string_multi()`. All callsites are adjusted so that they use `repo_config_get_string_multi(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/gc.c  | 4 ++--
 builtin/log.c | 2 +-
 config.h      | 6 ------
 reachable.c   | 2 +-
 versioncmp.c  | 4 ++--
 5 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index e94931ff48f..f395cc57a15 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1919,7 +1919,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
 	if (repo_config_get(the_repository, "maintenance.strategy"))
 		git_config_set("maintenance.strategy", "incremental");
 
-	if (!git_config_get_string_multi(key, &list)) {
+	if (!repo_config_get_string_multi(the_repository, key, &list)) {
 		for_each_string_list_item(item, list) {
 			if (!strcmp(maintpath, item->string)) {
 				found = 1;
@@ -1988,7 +1988,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
 	}
 	if (!(config_file
 	      ? git_configset_get_string_multi(&cs, key, &list)
-	      : git_config_get_string_multi(key, &list))) {
+	      : repo_config_get_string_multi(the_repository, key, &list))) {
 		for_each_string_list_item(item, list) {
 			if (!strcmp(maintpath, item->string)) {
 				found = 1;
diff --git a/builtin/log.c b/builtin/log.c
index 1bedc4ef355..b512f12e805 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
 	struct string_list *include = decoration_filter->include_ref_pattern;
 	const struct string_list *config_exclude;
 
-	if (!git_config_get_string_multi("log.excludeDecoration",
+	if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration",
 					 &config_exclude)) {
 		struct string_list_item *item;
 		for_each_string_list_item(item, config_exclude)
diff --git a/config.h b/config.h
index e90c1c4d335..f6635e48c23 100644
--- a/config.h
+++ b/config.h
@@ -719,12 +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_string_multi(const char *key,
-				const struct string_list **dest)
-{
-	return repo_config_get_string_multi(the_repository, key, dest);
-}
-
 static inline int git_config_get_string(const char *key, char **dest)
 {
 	return repo_config_get_string(the_repository, key, dest);
diff --git a/reachable.c b/reachable.c
index e984b68a0c4..8330a14fa82 100644
--- a/reachable.c
+++ b/reachable.c
@@ -170,7 +170,7 @@ static void load_gc_recent_objects(struct recent_data *data)
 
 	data->extra_recent_oids_loaded = 1;
 
-	if (git_config_get_string_multi("gc.recentobjectshook", &programs))
+	if (repo_config_get_string_multi(the_repository, "gc.recentobjectshook", &programs))
 		return;
 
 	for (i = 0; i < programs->nr; i++) {
diff --git a/versioncmp.c b/versioncmp.c
index b6eebdb989c..3a81b17bc1b 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -167,8 +167,8 @@ int versioncmp(const char *s1, const char *s2)
 		const char *const oldk = "versionsort.prereleasesuffix";
 		const struct string_list *newl;
 		const struct string_list *oldl;
-		int new = git_config_get_string_multi(newk, &newl);
-		int old = git_config_get_string_multi(oldk, &oldl);
+		int new = repo_config_get_string_multi(the_repository, newk, &newl);
+		int old = repo_config_get_string_multi(the_repository, oldk, &oldl);
 
 		if (!new && !old)
 			warning("ignoring %s because %s is set", oldk, newk);
-- 
2.50.1.465.gcb3da1c9e6.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 7 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.