git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 03/21] config: drop `git_config_get()` wrapper
Date: Thu, 17 Jul 2025 12:49:23 +0200	[thread overview]
Message-ID: <20250717-pks-config-wo-the-repository-v1-3-d888e4a17de1@pks.im> (raw)
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()`. All
callsites are adjusted so that they use `repo_config_get(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                | 2 +-
 builtin/submodule--helper.c | 6 +++---
 config.h                    | 5 -----
 t/helper/test-config.c      | 2 +-
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/builtin/gc.c b/builtin/gc.c
index d9e3b9d2ec3..e5c3d082eda 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1916,7 +1916,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
 	git_config_set("maintenance.auto", "false");
 
 	/* Set maintenance strategy, if unset */
-	if (git_config_get("maintenance.strategy"))
+	if (repo_config_get(the_repository, "maintenance.strategy"))
 		git_config_set("maintenance.strategy", "incremental");
 
 	if (!git_config_get_string_multi(key, &list)) {
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 89ee09abea6..6bcc741a6ac 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
 	 * If there are no path args and submodule.active is set then,
 	 * by default, only initialize 'active' modules.
 	 */
-	if (!argc && !git_config_get("submodule.active"))
+	if (!argc && !repo_config_get(the_repository, "submodule.active"))
 		module_list_active(&list);
 
 	info.prefix = prefix;
@@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
 		 * If there are no path args and submodule.active is set then,
 		 * by default, only initialize 'active' modules.
 		 */
-		if (!argc && !git_config_get("submodule.active"))
+		if (!argc && !repo_config_get(the_repository, "submodule.active"))
 			module_list_active(&list);
 
 		info.prefix = opt.prefix;
@@ -3349,7 +3349,7 @@ static void configure_added_submodule(struct add_data *add_data)
 	 * is_submodule_active(), since that function needs to find
 	 * out the value of "submodule.active" again anyway.
 	 */
-	if (!git_config_get("submodule.active")) {
+	if (!repo_config_get(the_repository, "submodule.active")) {
 		/*
 		 * If the submodule being added isn't already covered by the
 		 * current configured pathspec, set the submodule's active flag
diff --git a/config.h b/config.h
index 4eea99e9b95..9261ed0f8d7 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(const char *key)
-{
-	return repo_config_get(the_repository, key);
-}
-
 static inline int git_config_get_value(const char *key, const char **value)
 {
 	return repo_config_get_value(the_repository, key, value);
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 41ba8647900..cacf6f306b1 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -137,7 +137,7 @@ int cmd__config(int argc, const char **argv)
 	} else if (argc == 3 && !strcmp(argv[1], "get")) {
 		int ret;
 
-		if (!(ret = git_config_get(argv[2])))
+		if (!(ret = repo_config_get(the_repository, argv[2])))
 			goto exit0;
 		else if (ret == 1)
 			printf("Value not found for \"%s\"\n", argv[2]);

-- 
2.50.1.465.gcb3da1c9e6.dirty


  parent reply	other threads:[~2025-07-17 10:49 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 10:49 [PATCH 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` Patrick Steinhardt [this message]
2025-07-17 10:49 ` [PATCH 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 05/21] " Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 08/21] " Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
2025-07-17 10:49 ` [PATCH 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23  9:38   ` Phillip Wood
2025-07-23 13:38     ` Patrick Steinhardt
2025-07-23 14:08 ` [PATCH v2 00/21] config: remove use of `the_repository` Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 01/21] config: drop `git_config()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 02/21] config: drop `git_config_clear()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 03/21] config: drop `git_config_get()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 04/21] config: drop `git_config_get_value()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 05/21] " Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 06/21] config: drop `git_config_get_string_multi()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 07/21] config: drop `git_config_get_string()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 08/21] " Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 09/21] config: drop `git_config_get_int()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 10/21] config: drop `git_config_get_ulong()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 11/21] config: drop `git_config_get_bool()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 12/21] config: drop `git_config_set_in_file()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 13/21] config: drop `git_config_set_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 14/21] config: drop `git_config_set()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 15/21] config: drop `git_config_set_in_file_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 16/21] config: drop `git_config_set_multivar_in_file_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 17/21] config: drop `git_config_get_multivar_gently()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 18/21] config: drop `git_config_set_multivar()` wrapper Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 19/21] config: remove unused `the_repository` wrappers Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 20/21] config: move Git config parsing into "environment.c" Patrick Steinhardt
2025-07-23 14:08   ` [PATCH v2 21/21] config: fix sign comparison warnings Patrick Steinhardt
2025-07-23 14:48     ` Phillip Wood
2025-07-23 15:29     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717-pks-config-wo-the-repository-v1-3-d888e4a17de1@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).