]> git.ipfire.org Git - thirdparty/git.git/commit
pack-objects: don't check size when the object is bad
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 14 Apr 2018 15:35:08 +0000 (17:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Apr 2018 03:38:58 +0000 (12:38 +0900)
commit660b373542589157aff78dd37ce582237027ba94
treef67357eae9d26abec3f578157627cf5aa0106602
parent0cb3c1427a1e9cee638e0c1629933c907493d7e3
pack-objects: don't check size when the object is bad

sha1_object_info() in check_objects() may fail to locate an object in
the pack and return type OBJ_BAD. In that case, it will likely leave
the "size" field untouched. We delay error handling until later in
prepare_pack() though. Until then, do not touch "size" field.

This field should contain the default value zero, but we can't say
sha1_object_info() cannot damage it. This becomes more important later
when the object size may have to be retrieved back from the
(non-existing) pack.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c