diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-31 22:32:06 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 22:32:06 +0100 |
commit | 46ab22261661a8b4d2e86badc55d26017739dc31 (patch) | |
tree | e9352ba61eff34622265b97c350b29b6cc3eddd4 | |
parent | Merge branch 'mh/fast-import-notes-fix-new' into maint (diff) | |
parent | config.abbrev: document the new default that auto-scales (diff) | |
download | git-46ab22261661a8b4d2e86badc55d26017739dc31.tar.xz git-46ab22261661a8b4d2e86badc55d26017739dc31.zip |
Merge branch 'jc/abbrev-autoscale-config' into maint
Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.
* jc/abbrev-autoscale-config:
config.abbrev: document the new default that auto-scales
-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 aba7568bcd..1fee83ca42 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):: @@ -836,10 +836,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; } |