• J
    git-config: always treat --int as 64-bit internally · 00160242
    Jeff King 提交于
    When you run "git config --int", the maximum size of integer
    you get depends on how git was compiled, and what it
    considers to be an "int".
    
    This is almost useful, because your scripts calling "git
    config" will behave similarly to git internally. But relying
    on this is dubious; you have to actually know how git treats
    each value internally (e.g., int versus unsigned long),
    which is not documented and is subject to change. And even
    if you know it is "unsigned long", we do not have a
    git-config option to match that behavior.
    
    Furthermore, you may simply be asking git to store a value
    on your behalf (e.g., configuration for a hook). In that
    case, the relevant range check has nothing at all to do with
    git, but rather with whatever scripting tools you are using
    (and git has no way of knowing what the appropriate range is
    there).
    
    Not only is the range check useless, but it is actively
    harmful, as there is no way at all for scripts to look
    at config variables with large values. For instance, one
    cannot reliably get the value of pack.packSizeLimit via
    git-config. On an LP64 system, git happily uses a 64-bit
    "unsigned long" internally to represent the value, but the
    script cannot read any value over 2G.
    
    Ideally, the "--int" option would simply represent an
    arbitrarily large integer. For practical purposes, however,
    a 64-bit integer is large enough, and is much easier to
    implement (and if somebody overflows it, we will still
    notice the problem, and not simply return garbage).
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    00160242
config.c 42.9 KB