]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: use the_hash_algo in abbrev comparison
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 18 Aug 2019 20:04:13 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Aug 2019 22:04:58 +0000 (15:04 -0700)
Switch one use of a hard-coded 40 constant to use the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c

index 3900e4947be92b916ed9b531eb455e8f856105dc..b0f79aab21810e753dfed585c06c3ce2fc6472fd 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1204,7 +1204,7 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
                        default_abbrev = -1;
                else {
                        int abbrev = git_config_int(var, value);
-                       if (abbrev < minimum_abbrev || abbrev > 40)
+                       if (abbrev < minimum_abbrev || abbrev > the_hash_algo->hexsz)
                                return error(_("abbrev length out of range: %d"), abbrev);
                        default_abbrev = abbrev;
                }