]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: pass repo to `git_config_get_max_percent_split_change()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 13 Aug 2024 09:13:57 +0000 (11:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2024 17:01:03 +0000 (10:01 -0700)
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>
config.c
config.h
read-cache.c

index 89fb7ce6b1065014baff744cdb7dda7ffa13752d..f1d2fb6d4c0c7f530221fe86a9cbd0ea1ab5263c 100644 (file)
--- 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;
 
index 35cee9d4ca319e3de74cc3d91f2f8efb25977b7e..dd7127b8e979a15fc0dd6490242b0feb050c32ff 100644 (file)
--- 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);
index 12c2da5a8ba326f657a16f8e23433cfd007e0075..1e52db7f36f3d9d6ad0cdafbb073aa6d2fd36d71 100644 (file)
@@ -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: