struct pack_window *w_curs = NULL;
size_t pos = pack->bitmap_pos / BITS_IN_EWORD;
- if (allow_ref_delta && !pack->bitmap_pos) {
- if (!pack->bitmap_pos &&
++ if (allow_ref_delta && !pack->bitmap_pos &&
+ pack->bitmap_nr == pack->p->num_objects) {
/*
* If we're processing the first (in the case of a MIDX, the
* preferred pack) or the only (in the case of single-pack
* we're currently processing). So any duplicate bases will be
* resolved in favor of the pack we're processing.
*
+ * When REF_DELTAs are allowed, we can therefore reuse whole
+ * words at a time without inspecting object headers. Otherwise,
+ * inspect each object below to avoid reusing a REF_DELTA entry.
++ *
+ * The range must also contain every physical pack entry so that
+ * bitmap and pack positions correspond.
*/
while (pos < result->word_alloc &&
pos < pack->bitmap_nr / BITS_IN_EWORD &&