diff: switch GIT_SHA1_HEXSZ to use 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
Jul 16, 2018 at 01:28 UTC
02afca1ee4a2d0a5ccc5f81e6d45a6caaef28691
1 file changed
+3
-3
diff.c
+3
-3
@@ -3832,7 +3832,7 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
3832
char *hex = oid_to_hex(oid);
3833
if (abbrev < 0)
3834
abbrev = FALLBACK_DEFAULT_ABBREV;
3835
- if (abbrev > GIT_SHA1_HEXSZ)
3835
+ if (abbrev > the_hash_algo->hexsz)
3836
BUG("oid abbreviation out of range: %d", abbrev);
3837
if (abbrev)
3838
hex[abbrev] = '\0';
@@ -4947,7 +4947,7 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)
4947
const char *abbrev;
4948
4949
/* Do we want all 40 hex characters? */
4950
- if (len == GIT_SHA1_HEXSZ)
4950
+ if (len == the_hash_algo->hexsz)
4951
return oid_to_hex(oid);
4952
4953
/* 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)
4977
* the automatic sizing is supposed to give abblen that ensures
4978
* uniqueness across all objects (statistically speaking).
4979
*/
4980
- if (abblen < GIT_SHA1_HEXSZ - 3) {
4980
+ if (abblen < the_hash_algo->hexsz - 3) {
4981
static char hex[GIT_MAX_HEXSZ + 1];
4982
if (len < abblen && abblen <= len + 2)
4983
xsnprintf(hex, sizeof(hex), "%s%.*s", abbrev, len+3-abblen, "..");