@@ -310,7 +310,7 @@ static int init_object_disambiguation(const char *name, int len,
310310{
311311 int i ;
312312
313- if (len < MINIMUM_ABBREV || len > GIT_SHA1_HEXSZ )
313+ if (len < MINIMUM_ABBREV || len > the_hash_algo -> hexsz )
314314 return -1 ;
315315
316316 memset (ds , 0 , sizeof (* ds ));
@@ -576,6 +576,8 @@ int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len)
576576 struct disambiguate_state ds ;
577577 struct min_abbrev_data mad ;
578578 struct object_id oid_ret ;
579+ const unsigned hexsz = the_hash_algo -> hexsz ;
580+
579581 if (len < 0 ) {
580582 unsigned long count = approximate_object_count ();
581583 /*
@@ -599,8 +601,8 @@ int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len)
599601 }
600602
601603 oid_to_hex_r (hex , oid );
602- if (len == GIT_SHA1_HEXSZ || !len )
603- return GIT_SHA1_HEXSZ ;
604+ if (len == hexsz || !len )
605+ return hexsz ;
604606
605607 mad .init_len = len ;
606608 mad .cur_len = len ;
@@ -706,7 +708,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
706708 int refs_found = 0 ;
707709 int at , reflog_len , nth_prior = 0 ;
708710
709- if (len == GIT_SHA1_HEXSZ && !get_oid_hex (str , oid )) {
711+ if (len == the_hash_algo -> hexsz && !get_oid_hex (str , oid )) {
710712 if (warn_ambiguous_refs && warn_on_object_refname_ambiguity ) {
711713 refs_found = dwim_ref (str , len , & tmp_oid , & real_ref );
712714 if (refs_found > 0 ) {
@@ -750,7 +752,7 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
750752 int detached ;
751753
752754 if (interpret_nth_prior_checkout (str , len , & buf ) > 0 ) {
753- detached = (buf .len == GIT_SHA1_HEXSZ && !get_oid_hex (buf .buf , oid ));
755+ detached = (buf .len == the_hash_algo -> hexsz && !get_oid_hex (buf .buf , oid ));
754756 strbuf_release (& buf );
755757 if (detached )
756758 return 0 ;
0 commit comments