]> git.99rst.org Git - git.git/commit
bulk-checkin.c: store checksum directly
authorTaylor Blau <redacted>
Thu, 9 Sep 2021 23:24:32 +0000 (19:24 -0400)
committerJunio C Hamano <redacted>
Fri, 10 Sep 2021 01:23:11 +0000 (18:23 -0700)
commitae44b5a4f3b091bc77adc4a70e7bfefd569b78a8
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
bulk-checkin.c
git clone https://git.99rst.org/PROJECT