Merge branch 'cc/delta-islands'
Lift code from GitHub to restrict delta computation so that an object that exists in one fork is not made into a delta against another object that does not appear in the same forked repository. * cc/delta-islands: pack-objects: move 'layer' into 'struct packing_data' pack-objects: move tree_depth into 'struct packing_data' t5320: tests for delta islands repack: add delta-islands support pack-objects: add delta-islands support pack-objects: refactor code into compute_layer_order() Add delta-islands.{c,h}
This commit is contained in:
@ -103,6 +103,7 @@ struct object_entry {
|
||||
unsigned no_try_delta:1;
|
||||
unsigned type_:TYPE_BITS;
|
||||
unsigned in_pack_type:TYPE_BITS; /* could be delta */
|
||||
|
||||
unsigned preferred_base:1; /*
|
||||
* we do not pack this, but is available
|
||||
* to be used as the base object to delta
|
||||
@ -158,6 +159,10 @@ struct packing_data {
|
||||
|
||||
uintmax_t oe_size_limit;
|
||||
uintmax_t oe_delta_size_limit;
|
||||
|
||||
/* delta islands */
|
||||
unsigned int *tree_depth;
|
||||
unsigned char *layer;
|
||||
};
|
||||
|
||||
void prepare_packing_data(struct packing_data *pdata);
|
||||
@ -400,4 +405,38 @@ static inline void oe_set_delta_size(struct packing_data *pack,
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned int oe_tree_depth(struct packing_data *pack,
|
||||
struct object_entry *e)
|
||||
{
|
||||
if (!pack->tree_depth)
|
||||
return 0;
|
||||
return pack->tree_depth[e - pack->objects];
|
||||
}
|
||||
|
||||
static inline void oe_set_tree_depth(struct packing_data *pack,
|
||||
struct object_entry *e,
|
||||
unsigned int tree_depth)
|
||||
{
|
||||
if (!pack->tree_depth)
|
||||
ALLOC_ARRAY(pack->tree_depth, pack->nr_objects);
|
||||
pack->tree_depth[e - pack->objects] = tree_depth;
|
||||
}
|
||||
|
||||
static inline unsigned char oe_layer(struct packing_data *pack,
|
||||
struct object_entry *e)
|
||||
{
|
||||
if (!pack->layer)
|
||||
return 0;
|
||||
return pack->layer[e - pack->objects];
|
||||
}
|
||||
|
||||
static inline void oe_set_layer(struct packing_data *pack,
|
||||
struct object_entry *e,
|
||||
unsigned char layer)
|
||||
{
|
||||
if (!pack->layer)
|
||||
ALLOC_ARRAY(pack->layer, pack->nr_objects);
|
||||
pack->layer[e - pack->objects] = layer;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user