pack-objects: move tree_depth into 'struct packing_data'
[gitweb.git] / pack-objects.h
index 8eecd679913fba7e4e95f2839b2ac7579e465fed..3cb5527eeb2b146719284928fd29ea8c9b60360b 100644 (file)
@@ -101,7 +101,6 @@ struct object_entry {
        unsigned no_try_delta:1;
        unsigned in_pack_type:TYPE_BITS; /* could be delta */
 
-       unsigned int tree_depth; /* should be repositioned for packing? */
        unsigned char layer;
 
        unsigned preferred_base:1; /*
@@ -145,6 +144,9 @@ struct packing_data {
        struct packed_git **in_pack;
 
        uintmax_t oe_size_limit;
+
+       /* delta islands */
+       unsigned int *tree_depth;
 };
 
 void prepare_packing_data(struct packing_data *pdata);
@@ -350,4 +352,21 @@ static inline void oe_set_delta_size(struct packing_data *pack,
                    "where delta size is the same as entry size");
 }
 
+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;
+}
+
 #endif