Skip to content

Commit d8b7721

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be7537e commit d8b7721

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,11 +2811,11 @@ int repo_config_get_split_index(struct repository *r)
28112811
return -1; /* default value */
28122812
}
28132813

2814-
int git_config_get_max_percent_split_change(void)
2814+
int repo_config_get_max_percent_split_change(struct repository *r)
28152815
{
28162816
int val = -1;
28172817

2818-
if (!git_config_get_int("splitindex.maxpercentchange", &val)) {
2818+
if (!repo_config_get_int(r, "splitindex.maxpercentchange", &val)) {
28192819
if (0 <= val && val <= 100)
28202820
return val;
28212821

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ int git_config_get_pathname(const char *key, char **dest);
712712

713713
int repo_config_get_index_threads(struct repository *r, int *dest);
714714
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);
716716

717717
/* This dies if the configured or default date is in the future */
718718
int git_config_get_expiry(const char *key, const char **output);

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3275,7 +3275,7 @@ static const int default_max_percent_split_change = 20;
32753275
static int too_many_not_shared_entries(struct index_state *istate)
32763276
{
32773277
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);
32793279

32803280
switch (max_split) {
32813281
case -1:

0 commit comments

Comments
 (0)