Skip to content

Commit

Permalink
builtin/rev-parse: switch to use the_hash_algo
Browse files Browse the repository at this point in the history
Switch several hard-coded uses of the constant 40 to references to
the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
bk2204 authored and gitster committed Aug 19, 2019
1 parent 3190096 commit 7e0d029
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin/rev-parse.c
Expand Up @@ -593,6 +593,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
const char *name = NULL;
struct object_context unused;
struct strbuf buf = STRBUF_INIT;
const int hexsz = the_hash_algo->hexsz;

if (argc > 1 && !strcmp("--parseopt", argv[1]))
return cmd_parseopt(argc - 1, argv + 1, prefix);
Expand Down Expand Up @@ -730,8 +731,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
abbrev = strtoul(arg, NULL, 10);
if (abbrev < MINIMUM_ABBREV)
abbrev = MINIMUM_ABBREV;
else if (40 <= abbrev)
abbrev = 40;
else if (hexsz <= abbrev)
abbrev = hexsz;
continue;
}
if (!strcmp(arg, "--sq")) {
Expand Down

0 comments on commit 7e0d029

Please sign in to comment.