From f60ef2d65f2a1b3e19bf4c64287a5995f7a2cce4 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 27 Feb 2017 18:59:58 +0100 Subject: config: mark an error message up for translation Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 83fdecb1bc..2eaf8ad77a 100644 --- a/config.c +++ b/config.c @@ -1701,8 +1701,8 @@ int git_config_get_untracked_cache(void) if (!strcasecmp(v, "keep")) return -1; - error("unknown core.untrackedCache value '%s'; " - "using 'keep' default value", v); + error(_("unknown core.untrackedCache value '%s'; " + "using 'keep' default value"), v); return -1; } -- cgit v1.2.3 From 1f44b09b5891aa0dc30cc7b7fff0d29b985a5af6 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 27 Feb 2017 19:00:00 +0100 Subject: config: add git_config_get_split_index() This new function will be used in a following commit to know if we want to use the split index feature or not. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- config.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index 2eaf8ad77a..421e8c9da6 100644 --- a/config.c +++ b/config.c @@ -1709,6 +1709,16 @@ int git_config_get_untracked_cache(void) return -1; /* default value */ } +int git_config_get_split_index(void) +{ + int val; + + if (!git_config_get_maybe_bool("core.splitindex", &val)) + return val; + + return -1; /* default value */ +} + NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr) { -- cgit v1.2.3 From 72dcb7b3607e3349ac3367dc804b62ce1556842b Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 27 Feb 2017 19:00:07 +0100 Subject: 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 --- config.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index 421e8c9da6..cf212785bb 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) { -- cgit v1.2.3 From 77d67977cac46aa6c07c66ce9e2470f00feb9d20 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 27 Feb 2017 19:00:13 +0100 Subject: config: add git_config_get_expiry() from gc.c This function will be used in a following commit to get the expiration time of the shared index files from the config, and it is generic enough to be put in "config.c". Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- config.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index cf212785bb..d6c8f8f3ba 100644 --- a/config.c +++ b/config.c @@ -1685,6 +1685,19 @@ int git_config_get_pathname(const char *key, const char **dest) return ret; } +int git_config_get_expiry(const char *key, const char **output) +{ + int ret = git_config_get_string_const(key, output); + if (ret) + return ret; + if (strcmp(*output, "now")) { + unsigned long now = approxidate("now"); + if (approxidate(*output) >= now) + git_die_config(key, _("Invalid %s: '%s'"), key, *output); + } + return ret; +} + int git_config_get_untracked_cache(void) { int val = -1; -- cgit v1.2.3