Skip to content

Commit 02afca1

Browse files
bk2204gitster
authored andcommitted
diff: switch GIT_SHA1_HEXSZ to use the_hash_algo
Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b7f20f7 commit 02afca1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,7 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
38323832
char *hex = oid_to_hex(oid);
38333833
if (abbrev < 0)
38343834
abbrev = FALLBACK_DEFAULT_ABBREV;
3835-
if (abbrev > GIT_SHA1_HEXSZ)
3835+
if (abbrev > the_hash_algo->hexsz)
38363836
BUG("oid abbreviation out of range: %d", abbrev);
38373837
if (abbrev)
38383838
hex[abbrev] = '\0';
@@ -4947,7 +4947,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)
49474947
const char *abbrev;
49484948

49494949
/* Do we want all 40 hex characters? */
4950-
if (len == GIT_SHA1_HEXSZ)
4950+
if (len == the_hash_algo->hexsz)
49514951
return oid_to_hex(oid);
49524952

49534953
/* An abbreviated value is fine, possibly followed by an ellipsis. */
@@ -4977,7 +4977,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)
49774977
* the automatic sizing is supposed to give abblen that ensures
49784978
* uniqueness across all objects (statistically speaking).
49794979
*/
4980-
if (abblen < GIT_SHA1_HEXSZ - 3) {
4980+
if (abblen < the_hash_algo->hexsz - 3) {
49814981
static char hex[GIT_MAX_HEXSZ + 1];
49824982
if (len < abblen && abblen <= len + 2)
49834983
xsnprintf(hex, sizeof(hex), "%s%.*s", abbrev, len+3-abblen, "..");

0 commit comments

Comments
 (0)