]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
Merge branch 'ab/pager-exit-log'
[thirdparty/git.git] / config.c
index f5068231bde1b84b370e7507a531f7ae576cf8b1..f90b633dba21f3cf63698e62170dab15e316e3e5 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1155,15 +1155,6 @@ static void die_bad_number(const char *name, const char *value)
        if (!value)
                value = "";
 
-       if (!strcmp(name, "GIT_TEST_GETTEXT_POISON"))
-               /*
-                * We explicitly *don't* use _() here since it would
-                * cause an infinite loop with _() needing to call
-                * use_gettext_poison(). This is why marked up
-                * translations with N_() above.
-                */
-               die(bad_numeric, value, name, error_type);
-
        if (!(cf && cf->name))
                die(_(bad_numeric), value, name, _(error_type));
 
@@ -1189,6 +1180,20 @@ static void die_bad_number(const char *name, const char *value)
        }
 }
 
+NORETURN
+static void die_bad_bool(const char *name, const char *value)
+{
+       if (!strcmp(name, "GIT_TEST_GETTEXT_POISON"))
+               /*
+                * We explicitly *don't* use _() here since it would
+                * cause an infinite loop with _() needing to call
+                * use_gettext_poison().
+                */
+               die("bad boolean config value '%s' for '%s'", value, name);
+       else
+               die(_("bad boolean config value '%s' for '%s'"), value, name);
+}
+
 int git_config_int(const char *name, const char *value)
 {
        int ret;
@@ -1261,8 +1266,10 @@ int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
 
 int git_config_bool(const char *name, const char *value)
 {
-       int discard;
-       return !!git_config_bool_or_int(name, value, &discard);
+       int v = git_parse_maybe_bool(value);
+       if (v < 0)
+               die_bad_bool(name, value);
+       return v;
 }
 
 int git_config_string(const char **dest, const char *var, const char *value)