Re: [PATCH 1/3] pack-objects: fix tree_depth and layer invariants

2018-11-22 Thread Jeff King
On Tue, Nov 20, 2018 at 05:37:18PM +0100, Duy Nguyen wrote: > > But in (b), we use the number of stored objects, _not_ the allocated > > size of the objects array. So we can run into a situation like this: > > > > 1. packlist_alloc() needs to store the Nth object, so it grows the > >

Re: [PATCH 1/3] pack-objects: fix tree_depth and layer invariants

2018-11-20 Thread Junio C Hamano
Jeff King writes: > But in (b), we use the number of stored objects, _not_ the allocated > size of the objects array. So we can run into a situation like this: > > 1. packlist_alloc() needs to store the Nth object, so it grows the > objects array to M, where M > N. > > 2.

Re: [PATCH 1/3] pack-objects: fix tree_depth and layer invariants

2018-11-20 Thread Duy Nguyen
On Tue, Nov 20, 2018 at 11:04 AM Jeff King wrote: > > Commit 108f530385 (pack-objects: move tree_depth into 'struct > packing_data', 2018-08-16) dynamically manages a tree_depth array in > packing_data that maintains one of these invariants: > > 1. tree_depth is NULL (i.e., the requested

[PATCH 1/3] pack-objects: fix tree_depth and layer invariants

2018-11-20 Thread Jeff King
Commit 108f530385 (pack-objects: move tree_depth into 'struct packing_data', 2018-08-16) dynamically manages a tree_depth array in packing_data that maintains one of these invariants: 1. tree_depth is NULL (i.e., the requested options don't require us to track tree depths) 2. tree_depth