config: pass repo to `git_config_get_max_percent_split_change()`

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 13, 2024 at 11:13 UTC d8b772182c50430a85963ce92696fc077dafa913
3 files changed +4 -4
config.c
+2 -2
@@ -2811,11 +2811,11 @@ int repo_config_get_split_index(struct repository *r)
2811 return -1; /* default value */
2812 }
2813
2814 -int git_config_get_max_percent_split_change(void)
2814 +int repo_config_get_max_percent_split_change(struct repository *r)
2815 {
2816 int val = -1;
2817
2818 - if (!git_config_get_int("splitindex.maxpercentchange", &val)) {
2818 + if (!repo_config_get_int(r, "splitindex.maxpercentchange", &val)) {
2819 if (0 <= val && val <= 100)
2820 return val;
2821
config.h
+1 -1
@@ -712,7 +712,7 @@ int git_config_get_pathname(const char *key, char **dest);
712
713 int repo_config_get_index_threads(struct repository *r, int *dest);
714 int repo_config_get_split_index(struct repository *r);
715 -int git_config_get_max_percent_split_change(void);
715 +int repo_config_get_max_percent_split_change(struct repository *r);
716
717 /* This dies if the configured or default date is in the future */
718 int git_config_get_expiry(const char *key, const char **output);
read-cache.c
+1 -1
@@ -3275,7 +3275,7 @@ static const int default_max_percent_split_change = 20;
3275 static int too_many_not_shared_entries(struct index_state *istate)
3276 {
3277 int i, not_shared = 0;
3278 - int max_split = git_config_get_max_percent_split_change();
3278 + int max_split = repo_config_get_max_percent_split_change(the_repository);
3279
3280 switch (max_split) {
3281 case -1: