diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-12 14:41:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-12 14:41:00 -0700 |
commit | c7c377d83f46113233718eaeb9009e7e6242b03d (patch) | |
tree | 3bc9fc1badb48ac73f19fae949a72575c513ecc0 /builtin/config.c | |
parent | a194eaddca201163aa756faccd519f056bd3c35e (diff) | |
parent | 00160242770aea137ec7154a8e8406feef733926 (diff) | |
download | git-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.c | 7 |
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", |