bulk-checkin.c: store checksum directly
commitae44b5a4f3b091bc77adc4a70e7bfefd569b78a8
authorTaylor Blau <me@ttaylorr.com>
Thu, 9 Sep 2021 23:24:32 +0000 (9 19:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 01:23:11 +0000 (9 18:23 -0700)
tree2d403db4d8bc989acdcded88ea4ca173eee0e1ba
parent0c41a887b4729fe4899416ded42c40151afe00d0
bulk-checkin.c: store checksum directly

finish_bulk_checkin() stores the checksum from finalize_hashfile() by
writing to the `hash` member of `struct object_id`, but that hash has
nothing to do with an object id (it's just a convenient location that
happens to be sized correctly).

Store the hash directly in an unsigned char array. This behaves the same
as writing to the `hash` member, but makes the intent clearer (and
avoids allocating an extra four bytes for the `algo` member of `struct
object_id`). It likewise prevents the possibility of a segfault when
reading `algo` (e.g., by calling `oid_to_hex()`) if it is uninitialized.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bulk-checkin.c