Skip to content

Commit e16be13

Browse files
calvin-wan-googlegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afd2a1d commit e16be13

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

config.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,14 @@ void git_global_config(char **user_out, char **xdg_out)
21332133
int git_env_bool(const char *k, int def)
21342134
{
21352135
const char *v = getenv(k);
2136-
return v ? git_config_bool(k, v) : def;
2136+
int val;
2137+
if (!v)
2138+
return def;
2139+
val = git_parse_maybe_bool(v);
2140+
if (val < 0)
2141+
die(_("bad boolean environment value '%s' for '%s'"),
2142+
v, k);
2143+
return val;
21372144
}
21382145

21392146
/*

0 commit comments

Comments
 (0)