aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/config.c b/config.c
index 9a42ad2de..4be6c7ba2 100644
--- a/config.c
+++ b/config.c
@@ -543,18 +543,25 @@ int git_parse_ulong(const char *value, unsigned long *ret)
return 1;
}
-static void die_bad_config(const char *name)
+static void die_bad_number(const char *name, const char *value)
{
+ const char *reason = errno == ERANGE ?
+ "out of range" :
+ "invalid unit";
+ if (!value)
+ value = "";
+
if (cf && cf->name)
- die("bad config value for '%s' in %s", name, cf->name);
- die("bad config value for '%s'", name);
+ die("bad numeric config value '%s' for '%s' in %s: %s",
+ value, name, cf->name, reason);
+ die("bad numeric config value '%s' for '%s': %s", value, name, reason);
}
int git_config_int(const char *name, const char *value)
{
int ret;
if (!git_parse_int(value, &ret))
- die_bad_config(name);
+ die_bad_number(name, value);
return ret;
}
@@ -562,7 +569,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
{
unsigned long ret;
if (!git_parse_ulong(value, &ret))
- die_bad_config(name);
+ die_bad_number(name, value);
return ret;
}