static void midx_fanout_add_midx_fanout(struct midx_fanout *fanout,
struct multi_pack_index *m,
- int preferred_pack,
uint32_t cur_fanout)
{
uint32_t start = 0, end;
nth_midxed_pack_midx_entry(m,
&fanout->entries[fanout->nr],
cur_object);
- if (nth_midxed_pack_int_id(m, cur_object) == preferred_pack)
- fanout->entries[fanout->nr].preferred = 1;
- else
- fanout->entries[fanout->nr].preferred = 0;
+ fanout->entries[fanout->nr].preferred = 0;
fanout->nr++;
}
}
fanout.nr = 0;
if (m)
- midx_fanout_add_midx_fanout(&fanout, m, preferred_pack,
- cur_fanout);
+ midx_fanout_add_midx_fanout(&fanout, m, cur_fanout);
for (cur_pack = start_pack; cur_pack < nr_packs; cur_pack++) {
int preferred = cur_pack == preferred_pack;
preferred, cur_fanout);
}
+ if (-1 < preferred_pack && preferred_pack < start_pack)
+ midx_fanout_add_pack_fanout(&fanout, info,
+ preferred_pack, 1,
+ cur_fanout);
+
midx_fanout_sort(&fanout);
/*
git pack-objects --all --unpacked $objdir/pack/pack0 &&
# Generate a new MIDX which changes the preferred pack
- # to a pack contained in the existing MIDX, such that
- # not all objects from p2 that appear in the MIDX had
- # their copy selected from p2.
+ # to a pack contained in the existing MIDX.
git multi-pack-index write --bitmap \
--preferred-pack="pack-$p2.pack" &&
test_path_is_file $midx &&
test_path_is_file $midx-$(midx_checksum $objdir).bitmap &&
- # When the above circumstances are met, an existing bug
- # in the MIDX machinery will cause the reverse index to
- # be read incorrectly, resulting in failed clones (among
- # other things).
- test_must_fail git clone --no-local . clone2
+ # When the above circumstances are met, the preferred
+ # pack should change appropriately and clones should
+ # (still) succeed.
+ git clone --no-local . clone2
)
'