Skip to content

Commit be7537e

Browse files
pks-tgitster
authored andcommitted
config: pass repo to git_config_get_split_index()
Refactor `git_config_get_split_index()` 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 1870cc3 commit be7537e

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

builtin/update-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
11561156
end_odb_transaction();
11571157

11581158
if (split_index > 0) {
1159-
if (git_config_get_split_index() == 0)
1159+
if (repo_config_get_split_index(the_repository) == 0)
11601160
warning(_("core.splitIndex is set to false; "
11611161
"remove or change it, if you really want to "
11621162
"enable split index"));
@@ -1165,7 +1165,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
11651165
else
11661166
add_split_index(the_repository->index);
11671167
} else if (!split_index) {
1168-
if (git_config_get_split_index() == 1)
1168+
if (repo_config_get_split_index(the_repository) == 1)
11691169
warning(_("core.splitIndex is set to true; "
11701170
"remove or change it, if you really want to "
11711171
"disable split index"));

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,11 +2801,11 @@ int git_config_get_expiry_in_days(const char *key, timestamp_t *expiry, timestam
28012801
return -1; /* thing exists but cannot be parsed */
28022802
}
28032803

2804-
int git_config_get_split_index(void)
2804+
int repo_config_get_split_index(struct repository *r)
28052805
{
28062806
int val;
28072807

2808-
if (!git_config_get_maybe_bool("core.splitindex", &val))
2808+
if (!repo_config_get_maybe_bool(r, "core.splitindex", &val))
28092809
return val;
28102810

28112811
return -1; /* default value */

config.h

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

713713
int repo_config_get_index_threads(struct repository *r, int *dest);
714-
int git_config_get_split_index(void);
714+
int repo_config_get_split_index(struct repository *r);
715715
int git_config_get_max_percent_split_change(void);
716716

717717
/* This dies if the configured or default date is in the future */

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ static void tweak_untracked_cache(struct index_state *istate)
19451945

19461946
static void tweak_split_index(struct index_state *istate)
19471947
{
1948-
switch (git_config_get_split_index()) {
1948+
switch (repo_config_get_split_index(the_repository)) {
19491949
case -1: /* unset: do nothing */
19501950
break;
19511951
case 0: /* false */

0 commit comments

Comments
 (0)