From: Christian Couder Date: Mon, 27 Feb 2017 18:00:07 +0000 (+0100) Subject: config: add git_config_get_max_percent_split_change() X-Git-Tag: v2.13.0-rc0~111^2~12 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=72dcb7b3607e3349ac3367dc804b62ce1556842b;p=git-core%2Fgit.git config: add git_config_get_max_percent_split_change() 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 Signed-off-by: Junio C Hamano --- diff --git a/cache.h b/cache.h index c126fe475..e15b421b6 100644 --- a/cache.h +++ b/cache.h @@ -1822,6 +1822,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 421e8c9da..cf212785b 100644 --- a/config.c +++ b/config.c @@ -1719,6 +1719,21 @@ 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; + + return error(_("splitIndex.maxPercentChange value '%d' " + "should be between 0 and 100"), val); + } + + return -1; /* default value */ +} + NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr) {