The new function will be used to parse GIT_MMAP_LIMIT and GIT_ALLOC_LIMIT. Signed-off-by: Steffen Prohaska <prohaska@xxxxxx> --- cache.h | 1 + config.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/cache.h b/cache.h index fcb511d..b820b6a 100644 --- a/cache.h +++ b/cache.h @@ -1318,6 +1318,7 @@ extern int git_config_rename_section_in_file(const char *, const char *, const c extern const char *git_etc_gitconfig(void); extern int check_repository_format_version(const char *var, const char *value, void *cb); extern int git_env_bool(const char *, int); +extern unsigned long git_env_ulong(const char *, unsigned long); extern int git_config_system(void); extern int config_error_nonbool(const char *); #if defined(__GNUC__) diff --git a/config.c b/config.c index 058505c..178721f 100644 --- a/config.c +++ b/config.c @@ -1122,6 +1122,17 @@ int git_env_bool(const char *k, int def) return v ? git_config_bool(k, v) : def; } +/* + * Use default if environment variable is unset or empty string. + */ +unsigned long git_env_ulong(const char *k, unsigned long val) +{ + const char *v = getenv(k); + if (v && *v && !git_parse_ulong(v, &val)) + die("failed to parse %s", k); + return val; +} + int git_config_system(void) { return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0); -- 2.1.0.8.gf3a29c8 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html