summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-02 01:34:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-22 21:17:15 (GMT)
commit48d5014dd42cc4a4465162c9807eaa253715e105 (patch)
tree5b9c28a6b72920ba051a32e69e0f49fd7f983bec /config.c
parentbe5a750939c212bc0781ffa04fabcfd2b2bd744e (diff)
downloadgit-48d5014dd42cc4a4465162c9807eaa253715e105.zip
git-48d5014dd42cc4a4465162c9807eaa253715e105.tar.gz
git-48d5014dd42cc4a4465162c9807eaa253715e105.tar.bz2
config.abbrev: document the new default that auto-scales
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>
Diffstat (limited to 'config.c')
-rw-r--r--config.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/config.c b/config.c
index 83fdecb..1c57120 100644
--- a/config.c
+++ b/config.c
@@ -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;
}