pack-objects: move in_pack_pos out of struct object_entry
This field is only need for pack-bitmap, which is an optional feature. Move it to a separate array that is only allocated when pack-bitmap is used (like objects[], it is not freed, since we need it until the end of the process) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b5c0cbd808
commit
06af3bba41
@ -48,7 +48,8 @@ void bitmap_writer_show_progress(int show)
|
||||
/**
|
||||
* Build the initial type index for the packfile
|
||||
*/
|
||||
void bitmap_writer_build_type_index(struct pack_idx_entry **index,
|
||||
void bitmap_writer_build_type_index(struct packing_data *to_pack,
|
||||
struct pack_idx_entry **index,
|
||||
uint32_t index_nr)
|
||||
{
|
||||
uint32_t i;
|
||||
@ -57,12 +58,13 @@ void bitmap_writer_build_type_index(struct pack_idx_entry **index,
|
||||
writer.trees = ewah_new();
|
||||
writer.blobs = ewah_new();
|
||||
writer.tags = ewah_new();
|
||||
ALLOC_ARRAY(to_pack->in_pack_pos, to_pack->nr_objects);
|
||||
|
||||
for (i = 0; i < index_nr; ++i) {
|
||||
struct object_entry *entry = (struct object_entry *)index[i];
|
||||
enum object_type real_type;
|
||||
|
||||
entry->in_pack_pos = i;
|
||||
oe_set_in_pack_pos(to_pack, entry, i);
|
||||
|
||||
switch (oe_type(entry)) {
|
||||
case OBJ_COMMIT:
|
||||
@ -146,7 +148,7 @@ static uint32_t find_object_pos(const unsigned char *sha1)
|
||||
"(object %s is missing)", sha1_to_hex(sha1));
|
||||
}
|
||||
|
||||
return entry->in_pack_pos;
|
||||
return oe_in_pack_pos(writer.to_pack, entry);
|
||||
}
|
||||
|
||||
static void show_object(struct object *object, const char *name, void *data)
|
||||
|
Reference in New Issue
Block a user