Merge branch 'pw/rebase-abort-clean-rewritten' into maint
[gitweb.git] / pack-bitmap-write.c
index 5566e94abed9f0838d4c1d999ee8e90159000256..802ed62677dc995cc08d747a7c85dc1f17109503 100644 (file)
@@ -142,13 +142,13 @@ static inline void reset_all_seen(void)
        seen_objects_nr = 0;
 }
 
-static uint32_t find_object_pos(const unsigned char *sha1)
+static uint32_t find_object_pos(const unsigned char *hash)
 {
-       struct object_entry *entry = packlist_find(writer.to_pack, sha1, NULL);
+       struct object_entry *entry = packlist_find(writer.to_pack, hash, NULL);
 
        if (!entry) {
                die("Failed to write bitmap index. Packfile doesn't have full closure "
-                       "(object %s is missing)", sha1_to_hex(sha1));
+                       "(object %s is missing)", hash_to_hex(hash));
        }
 
        return oe_in_pack_pos(writer.to_pack, entry);
@@ -535,7 +535,7 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
        header.entry_count = htonl(writer.selected_nr);
        hashcpy(header.checksum, writer.pack_checksum);
 
-       hashwrite(f, &header, sizeof(header));
+       hashwrite(f, &header, sizeof(header) - GIT_MAX_RAWSZ + the_hash_algo->rawsz);
        dump_bitmap(f, writer.commits);
        dump_bitmap(f, writer.trees);
        dump_bitmap(f, writer.blobs);