summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
commit33cf69403c29880fb2b3de71be42fdc428dcca19 (patch)
tree064bc9bcb2e1c9e8e1d23d5e79a08def5e3bcd80 /config.c
parentMerge branch 'mh/fast-import-notes-fix-new' (diff)
parentconfig.abbrev: document the new default that auto-scales (diff)
downloadtgif-33cf69403c29880fb2b3de71be42fdc428dcca19.tar.xz
Merge branch 'jc/abbrev-autoscale-config'
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
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 2f1aef742e..0b9c1b62bb 100644
--- a/config.c
+++ b/config.c
@@ -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;
}