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

[PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 23, 2025, 14:08 UTC
Message-ID
<20250723-pks-config-wo-the-repository-v2-17-1502d60d3867@pks.im>
In-Reply-To
<20250723-pks-config-wo-the-repository-v2-0-1502d60d3867@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_multivar_gently()`. All callsites are adjusted so that they use `repo_config_get_multivar_gently(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>
---
 branch.c         | 2 +-
 builtin/clone.c  | 8 ++++----
 builtin/remote.c | 4 ++--
 config.h         | 7 -------
 scalar.c         | 6 +++---
 5 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/branch.c b/branch.c
index 3dc237adf6c..26be3583471 100644
--- a/branch.c
+++ b/branch.c
@@ -130,7 +130,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
 	if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
 		goto out_err;
 	for_each_string_list_item(item, remotes)
-		if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
+		if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
 			goto out_err;
 
 	if (rebasing) {
diff --git a/builtin/clone.c b/builtin/clone.c
index f025a8f19e0..183297787cb 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
 {
 	/*
 	 * give git_clone_config a chance to write config values back to the
-	 * environment, since git_config_set_multivar_gently only deals with
+	 * environment, since repo_config_set_multivar_gently only deals with
 	 * config-file writes
 	 */
 	int apply_failed = git_clone_config(key, value, ctx, data);
 	if (apply_failed)
 		return apply_failed;
 
-	return git_config_set_multivar_gently(key,
-					      value ? value : "true",
-					      CONFIG_REGEX_NONE, 0);
+	return repo_config_set_multivar_gently(the_repository, key,
+					       value ? value : "true",
+					       CONFIG_REGEX_NONE, 0);
 }
 
 static void write_config(struct string_list *config)
diff --git a/builtin/remote.c b/builtin/remote.c
index 827639e0398..dd340a33259 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1633,8 +1633,8 @@ static int update(int argc, const char **argv, const char *prefix,
 
 static int remove_all_fetch_refspecs(const char *key)
 {
-	return git_config_set_multivar_gently(key, NULL, NULL,
-					      CONFIG_FLAGS_MULTI_REPLACE);
+	return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
+					       CONFIG_FLAGS_MULTI_REPLACE);
 }
 
 static void add_branches(struct remote *remote, const char **branches,
diff --git a/config.h b/config.h
index e69592ada15..a90b814292c 100644
--- a/config.h
+++ b/config.h
@@ -745,13 +745,6 @@ static inline void git_config_set_multivar_in_file(
 					 key, value, value_pattern, flags);
 }
 
-static inline int git_config_set_multivar_gently(const char *key, const char *value,
-				   const char *value_pattern, unsigned flags)
-{
-	return repo_config_set_multivar_gently(the_repository, key, value,
-					       value_pattern, flags);
-}
-
 static inline void git_config_set_multivar(const char *key, const char *value,
 			     const char *value_pattern, unsigned flags)
 {
diff --git a/scalar.c b/scalar.c
index c09c5ca194e..4a373c133d8 100644
--- a/scalar.c
+++ b/scalar.c
@@ -196,9 +196,9 @@ static int set_recommended_config(int reconfigure)
 	if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) {
 		trace2_data_string("scalar", the_repository,
 				   "log.excludeDecoration", "created");
-		if (git_config_set_multivar_gently("log.excludeDecoration",
-						   "refs/prefetch/*",
-						   CONFIG_REGEX_NONE, 0))
+		if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration",
+						    "refs/prefetch/*",
+						    CONFIG_REGEX_NONE, 0))
 			return error(_("could not configure "
 				       "log.excludeDecoration"));
 	} else {
-- 
2.50.1.552.g942d659e1b.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 42 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.