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 <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder 2017-02-27 19:00:07 +01:00 коммит произвёл Junio C Hamano
Родитель 13c0e4c478
Коммит 72dcb7b360
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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)
{