pretty: switch hard-coded constants to the_hash_algo
Switch several hard-coded constants into expressions based either on GIT_MAX_HEXSZ or 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
580f0980e11b9dcfdaf0f8af12b8cef7c702a7e1
1 file changed
+2
-2
pretty.c
+2
-2
@@ -1575,7 +1575,7 @@ static void pp_header(struct pretty_print_context *pp,
1575
}
1576
1577
if (starts_with(line, "parent ")) {
1578
- if (linelen != 48)
1578
+ if (linelen != the_hash_algo->hexsz + 8)
1579
die("bad parent line in commit");
1580
continue;
1581
}
@@ -1583,7 +1583,7 @@ static void pp_header(struct pretty_print_context *pp,
1583
if (!parents_shown) {
1584
unsigned num = commit_list_count(commit->parents);
1585
/* with enough slop */
1586
- strbuf_grow(sb, num * 50 + 20);
1586
+ strbuf_grow(sb, num * (GIT_MAX_HEXSZ + 10) + 20);
1587
add_merge_info(pp, sb, commit);
1588
parents_shown = 1;
1589
}