]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pack-bitmap-write.c
am: avoid directory rename detection when calling recursive merge machinery
[thirdparty/git.git] / pack-bitmap-write.c
index 9d1bb054bbbee6631bc2c9acae529da813548367..7b2dc3e7dc768a2d2405a9ae3b1d13f86069a93d 100644 (file)
@@ -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,23 +58,25 @@ 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 (entry->type) {
+               switch (oe_type(entry)) {
                case OBJ_COMMIT:
                case OBJ_TREE:
                case OBJ_BLOB:
                case OBJ_TAG:
-                       real_type = entry->type;
+                       real_type = oe_type(entry);
                        break;
 
                default:
-                       real_type = oid_object_info(&entry->idx.oid, NULL);
+                       real_type = oid_object_info(the_repository,
+                                                   &entry->idx.oid, NULL);
                        break;
                }
 
@@ -97,7 +100,7 @@ void bitmap_writer_build_type_index(struct pack_idx_entry **index,
                default:
                        die("Missing type information for %s (%d/%d)",
                            oid_to_hex(&entry->idx.oid), real_type,
-                           entry->type);
+                           oe_type(entry));
                }
        }
 }
@@ -146,7 +149,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)
@@ -474,7 +477,7 @@ static void write_selected_commits_v1(struct hashfile *f,
                        sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
 
                if (commit_pos < 0)
-                       die("BUG: trying to write commit not in index");
+                       BUG("trying to write commit not in index");
 
                hashwrite_be32(f, commit_pos);
                hashwrite_u8(f, stored->xor_offset);