revision: replace use of hard-coded constants

Replace two uses of the hard-coded constant 40 with references to the_hash_algo. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 2, 2018 at 00:25 UTC fd521245e6a2dc3c84500980951d07947f862183
1 file changed +3 -2
revision.c
+3 -2
@@ -1751,6 +1751,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1751 const char *arg = argv[0];
1752 const char *optarg;
1753 int argcount;
1754 + const unsigned hexsz = the_hash_algo->hexsz;
1755
1756 /* pseudo revision arguments */
1757 if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
@@ -2038,8 +2039,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
2039 revs->abbrev = strtoul(optarg, NULL, 10);
2040 if (revs->abbrev < MINIMUM_ABBREV)
2041 revs->abbrev = MINIMUM_ABBREV;
2041 - else if (revs->abbrev > 40)
2042 - revs->abbrev = 40;
2042 + else if (revs->abbrev > hexsz)
2043 + revs->abbrev = hexsz;
2044 } else if (!strcmp(arg, "--abbrev-commit")) {
2045 revs->abbrev_commit = 1;
2046 revs->abbrev_commit_given = 1;