diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-11-01 18:34:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-22 13:17:15 -0800 |
commit | 48d5014dd42cc4a4465162c9807eaa253715e105 (patch) | |
tree | 5b9c28a6b72920ba051a32e69e0f49fd7f983bec | |
parent | be5a750939c212bc0781ffa04fabcfd2b2bd744e (diff) | |
download | git-jc/abbrev-autoscale-config.tar.gz |
config.abbrev: document the new default that auto-scalesjc/abbrev-autoscale-config
We somehow forgot to update the "default is 7" in the
documentation. Also give a way to explicitly ask the auto-scaling
by setting config.abbrev to "auto".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Documentation/config.txt | 9 | ||||
-rw-r--r-- | config.c | 14 |
2 files changed, 15 insertions, 8 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index a0ab66aae7..b02f8a4025 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -783,10 +783,11 @@ core.sparseCheckout:: linkgit:git-read-tree[1] for more information. core.abbrev:: - Set the length object names are abbreviated to. If unspecified, - many commands abbreviate to 7 hexdigits, which may not be enough - for abbreviated object names to stay unique for sufficiently long - time. + Set the length object names are abbreviated to. If + unspecified or set to "auto", an appropriate value is + computed based on the approximate number of packed objects + in your repository, which hopefully is enough for + abbreviated object names to stay unique for some time. add.ignoreErrors:: add.ignore-errors (deprecated):: @@ -834,10 +834,16 @@ static int git_default_core_config(const char *var, const char *value) } if (!strcmp(var, "core.abbrev")) { - int abbrev = git_config_int(var, value); - if (abbrev < minimum_abbrev || abbrev > 40) - return -1; - default_abbrev = abbrev; + if (!value) + return config_error_nonbool(var); + if (!strcasecmp(value, "auto")) + default_abbrev = -1; + else { + int abbrev = git_config_int(var, value); + if (abbrev < minimum_abbrev || abbrev > 40) + return error("abbrev length out of range: %d", abbrev); + default_abbrev = abbrev; + } return 0; } |