Re: [PATCH v7 10/13] pack-objects: clarify the use of object_entry::size
- From
Jeff King <peff@peff.net>
- Date
- Mar 30, 2018, 21:04 UTC
- Message-ID
- <20180330210416.GH14782@sigill.intra.peff.net>
- In-Reply-To
- <20180324063353.24722-11-pclouds@gmail.com>
On Sat, Mar 24, 2018 at 07:33:50AM +0100, Nguyễn Thái Ngọc Duy wrote:
Show 11 quoted lines
> 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.
Thanks for digging down here. I have definitely been confused by this in the past.
The subject says "clarify" so I was a little surprised to see code changes. It looks like we're just avoiding reassigning on top of the value repeatedly, which is part of that clarification. It looks like a noop to me.
-Peff