This new function will be used in a following commit to get the value of the "splitIndex.maxPercentChange" config variable. Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- cache.h | 1 + config.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cache.h b/cache.h index 394da60..faceceb 100644 --- a/cache.h +++ b/cache.h @@ -1810,6 +1810,7 @@ extern int git_config_get_maybe_bool(const char *key, int *dest); extern int git_config_get_pathname(const char *key, const char **dest); extern int git_config_get_untracked_cache(void); extern int git_config_get_split_index(void); +extern int git_config_get_max_percent_split_change(void); /* * This is a hack for test programs like test-dump-untracked-cache to diff --git a/config.c b/config.c index 036e29b..5580f56 100644 --- a/config.c +++ b/config.c @@ -1719,6 +1719,22 @@ int git_config_get_split_index(void) return -1; /* default value */ } +int git_config_get_max_percent_split_change(void) +{ + int val = -1; + + if (!git_config_get_int("splitindex.maxpercentchange", &val)) { + if (0 <= val && val <= 100) + return val; + + error("splitindex.maxpercentchange value '%d' " + "should be between 0 and 100", val); + return -1; + } + + return -1; /* default value */ +} + NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr) { -- 2.10.1.462.g7e1e03a