On 12/13/2021 8:55 PM, Taylor Blau wrote: ... > Note that we have two knobs that are adjusted for the new tests: > GIT_TEST_MIDX_WRITE_REV and GIT_TEST_MIDX_READ_RIDX. The former controls > whether the MIDX .rev is written at all, and the latter controls whether > we read the MIDX's RIDX chunk. ... > + if (git_env_bool("GIT_TEST_MIDX_READ_RIDX", 1)) > + pair_chunk(cf, MIDX_CHUNKID_REVINDEX, &m->chunk_revindex); > + Skip reading if GIT_TEST_MIDX_READ_RIDX=0 (do read if true or unset). Good. > - if (flags & MIDX_WRITE_REV_INDEX) > + if (flags & MIDX_WRITE_REV_INDEX && > + git_env_bool("GIT_TEST_MIDX_WRITE_REV", 0)) > write_midx_reverse_index(midx_name.buf, midx_hash, &ctx); Only write if GIT_TEST_MIDX_WRITE_REV=1 (skip if false or unset). Good. > + if (m->chunk_revindex) { > + /* > + * If the MIDX `m` has a `RIDX` chunk, then use its contents for > + * the reverse index instead of trying to load a separate `.rev` > + * file. > + * > + * Note that we do *not* set `m->revindex_map` here, since we do > + * not want to accidentally call munmap() in the middle of the > + * MIDX. > + */ > + trace2_data_string("load_midx_revindex", the_repository, > + "source", "midx"); > + m->revindex_data = (const uint32_t *)m->chunk_revindex; > + return 0; > + } > + > trace2_data_string("load_midx_revindex", the_repository, > "source", "rev"); A natural way to do this. > > diff --git a/t/lib-bitmap.sh b/t/lib-bitmap.sh > index 0a35daf939..f5eaa9cf68 100644 > --- a/t/lib-bitmap.sh > +++ b/t/lib-bitmap.sh > @@ -291,7 +291,7 @@ test_rev_exists () { > } > > midx_bitmap_core () { > - rev_kind="${1:-rev}" > + rev_kind="${1:-midx}" > > setup_bitmap_history > > @@ -435,7 +435,7 @@ midx_bitmap_core () { > } > > midx_bitmap_partial_tests () { > - rev_kind="${1:-rev}" > + rev_kind="${1:-midx}" And I'm glad we can just update the default here. > diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh > index 100ac90d15..8c92acb0ce 100755 > --- a/t/t5326-multi-pack-bitmaps.sh > +++ b/t/t5326-multi-pack-bitmaps.sh > @@ -9,6 +9,11 @@ test_description='exercise basic multi-pack bitmap functionality' > GIT_TEST_MULTI_PACK_INDEX=0 > GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0 > > +GIT_TEST_MIDX_WRITE_REV=0 > +GIT_TEST_MIDX_READ_RIDX=1 > +export GIT_TEST_MIDX_WRITE_REV > +export GIT_TEST_MIDX_READ_RIDX Technically, we could unset these variables, right? ("...=") > diff --git a/t/t5327-multi-pack-bitmaps-rev.sh b/t/t5327-multi-pack-bitmaps-rev.sh ... > +# We'll be writing our own midx and bitmaps, so avoid getting confused by the > +# automatic ones. > +GIT_TEST_MULTI_PACK_INDEX=0 > +GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0 > + > +# Unlike t5326, this test exercise multi-pack bitmap functionality where the > +# object order is stored in a separate .rev file. > +GIT_TEST_MIDX_WRITE_REV=1 > +GIT_TEST_MIDX_READ_RIDX=0 > +export GIT_TEST_MIDX_WRITE_REV > +export GIT_TEST_MIDX_READ_RIDX > + > +midx_bitmap_core rev > +midx_bitmap_partial_tests rev > + > +test_done Nice that now we get the payoff of the test refactor. This new script exists only to verify that we can still read the old .rev files, which is important for compatibility. Forgive me for "speaking out loud" throughout this patch. I don't see any need for changes but it is the crux of making this series work. Thanks, -Stolee