diff mbox series

[v2,12/20] config: pass repo to `git_config_get_max_percent_split_change()`

Message ID 17c5420d6386f46a730940de15eed03d2f9db75a.1723540226.git.ps@pks.im (mailing list archive)
State Accepted
Commit d8b772182c50430a85963ce92696fc077dafa913
Headers show
Series Stop using `the_repository` in "config.c" | expand

Commit Message

Patrick Steinhardt Aug. 13, 2024, 9:13 a.m. UTC
Refactor `git_config_get_max_percent_split_change()` to accept a `struct
repository` such that we can get rid of the implicit dependency on
`the_repository`. Rename the function accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 config.c     | 4 ++--
 config.h     | 2 +-
 read-cache.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/config.c b/config.c
index 89fb7ce6b1..f1d2fb6d4c 100644
--- a/config.c
+++ b/config.c
@@ -2811,11 +2811,11 @@  int repo_config_get_split_index(struct repository *r)
 	return -1; /* default value */
 }
 
-int git_config_get_max_percent_split_change(void)
+int repo_config_get_max_percent_split_change(struct repository *r)
 {
 	int val = -1;
 
-	if (!git_config_get_int("splitindex.maxpercentchange", &val)) {
+	if (!repo_config_get_int(r, "splitindex.maxpercentchange", &val)) {
 		if (0 <= val && val <= 100)
 			return val;
 
diff --git a/config.h b/config.h
index 35cee9d4ca..dd7127b8e9 100644
--- a/config.h
+++ b/config.h
@@ -712,7 +712,7 @@  int git_config_get_pathname(const char *key, char **dest);
 
 int repo_config_get_index_threads(struct repository *r, int *dest);
 int repo_config_get_split_index(struct repository *r);
-int git_config_get_max_percent_split_change(void);
+int repo_config_get_max_percent_split_change(struct repository *r);
 
 /* This dies if the configured or default date is in the future */
 int git_config_get_expiry(const char *key, const char **output);
diff --git a/read-cache.c b/read-cache.c
index 12c2da5a8b..1e52db7f36 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -3275,7 +3275,7 @@  static const int default_max_percent_split_change = 20;
 static int too_many_not_shared_entries(struct index_state *istate)
 {
 	int i, not_shared = 0;
-	int max_split = git_config_get_max_percent_split_change();
+	int max_split = repo_config_get_max_percent_split_change(the_repository);
 
 	switch (max_split) {
 	case -1: