]> git.ipfire.org Git - thirdparty/git.git/commit - pack-objects.h
pack-objects: clarify the use of object_entry::size
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 14 Apr 2018 15:35:09 +0000 (17:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Apr 2018 03:38:59 +0000 (12:38 +0900)
commit27a7d0679f17bd536f566e76e51058de0e1fa17a
treebddb22342ff1e11888fad86db46a4d981041b6d5
parent660b373542589157aff78dd37ce582237027ba94
pack-objects: clarify the use of object_entry::size

While this field most of the time contains the canonical object size,
there is one case it does not: when we have found that the base object
of the delta in question is also to be packed, we will very happily
reuse the delta by copying it over instead of regenerating the new
delta.

"size" in this case will record the delta size, not canonical object
size. Later on in write_reuse_object(), we reconstruct the delta
header and "size" is used for this purpose. When this happens, the
"type" field contains a delta type instead of a canonical type.
Highlight this in the code since it could be tricky to see.

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
pack-objects.h