From: Calvin Wan Date: Fri, 29 Sep 2023 21:20:50 +0000 (-0700) Subject: config: correct bad boolean env value error message X-Git-Tag: v2.43.0-rc0~48^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e16be13cfaf1102340c7816d14cec2009a864faf;p=thirdparty%2Fgit.git config: correct bad boolean env value error message An incorrectly defined boolean environment value would result in the following error message: bad boolean config value '%s' for '%s' This is a misnomer since environment value != config value. Instead of calling git_config_bool() to parse the environment value, mimic the functionality inside of git_config_bool() but with the correct error message. Signed-off-by: Calvin Wan Signed-off-by: Junio C Hamano --- diff --git a/config.c b/config.c index 3846a37be9..7dde0aaa02 100644 --- a/config.c +++ b/config.c @@ -2133,7 +2133,14 @@ void git_global_config(char **user_out, char **xdg_out) int git_env_bool(const char *k, int def) { const char *v = getenv(k); - return v ? git_config_bool(k, v) : def; + int val; + if (!v) + return def; + val = git_parse_maybe_bool(v); + if (val < 0) + die(_("bad boolean environment value '%s' for '%s'"), + v, k); + return val; } /*