Skip to content

Commit 580f098

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 94b5e09 commit 580f098

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pretty.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,15 +1575,15 @@ static void pp_header(struct pretty_print_context *pp,
15751575
}
15761576

15771577
if (starts_with(line, "parent ")) {
1578-
if (linelen != 48)
1578+
if (linelen != the_hash_algo->hexsz + 8)
15791579
die("bad parent line in commit");
15801580
continue;
15811581
}
15821582

15831583
if (!parents_shown) {
15841584
unsigned num = commit_list_count(commit->parents);
15851585
/* with enough slop */
1586-
strbuf_grow(sb, num * 50 + 20);
1586+
strbuf_grow(sb, num * (GIT_MAX_HEXSZ + 10) + 20);
15871587
add_merge_info(pp, sb, commit);
15881588
parents_shown = 1;
15891589
}

0 commit comments

Comments
 (0)