Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Wan <calvinwan@google.com>2023-09-30 00:20:50 +0300
committerJunio C Hamano <gitster@pobox.com>2023-09-30 01:14:56 +0300
commite16be13cfaf1102340c7816d14cec2009a864faf (patch)
tree69112331c66161daef19e4af91c713cc22b198f0 /config.c
parentafd2a1d5f1fc371fe1fda0ed07e0f2f27100fbab (diff)
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 <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c9
1 files changed, 8 insertions, 1 deletions
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;
}
/*