summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-12 14:41:00 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-12 14:41:00 -0700
commitc7c377d83f46113233718eaeb9009e7e6242b03d (patch)
tree3bc9fc1badb48ac73f19fae949a72575c513ecc0 /builtin/config.c
parenta194eaddca201163aa756faccd519f056bd3c35e (diff)
parent00160242770aea137ec7154a8e8406feef733926 (diff)
downloadgit-c7c377d83f46113233718eaeb9009e7e6242b03d.tar.gz
Merge branch 'jk/config-int-range-check'
"git config" did not provide a way to set or access numbers larger than a native "int" on the platform; it now provides 64-bit signed integers on all platforms. * jk/config-int-range-check: git-config: always treat --int as 64-bit internally config: make numeric parsing errors more clear config: set errno in numeric git_parse_* functions config: properly range-check integer values config: factor out integer parsing from range checks
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/config.c b/builtin/config.c
index fc8d8820cb..20e89fe4e0 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -119,7 +119,8 @@ static int format_config(struct strbuf *buf, const char *key_, const char *value
must_print_delim = 1;
}
if (types == TYPE_INT)
- sprintf(value, "%d", git_config_int(key_, value_ ? value_ : ""));
+ sprintf(value, "%"PRId64,
+ git_config_int64(key_, value_ ? value_ : ""));
else if (types == TYPE_BOOL)
vptr = git_config_bool(key_, value_) ? "true" : "false";
else if (types == TYPE_BOOL_OR_INT) {
@@ -268,8 +269,8 @@ static char *normalize_value(const char *key, const char *value)
else {
normalized = xmalloc(64);
if (types == TYPE_INT) {
- int v = git_config_int(key, value);
- sprintf(normalized, "%d", v);
+ int64_t v = git_config_int64(key, value);
+ sprintf(normalized, "%"PRId64, v);
}
else if (types == TYPE_BOOL)
sprintf(normalized, "%s",