> +static void midx_snapshot_refs(struct tempfile *f) > +{ > + struct midx_snapshot_ref_data data; > + const struct string_list *preferred = bitmap_preferred_tips(the_repository); > + > + data.f = f; > + oidset_init(&data.seen, 0); > + > + if (!fdopen_tempfile(f, "w")) > + die(_("could not open tempfile %s for writing"), > + get_tempfile_path(f)); > + > + if (preferred) { > + struct string_list_item *item; > + > + data.preferred = 1; > + for_each_string_list_item(item, preferred) > + for_each_ref_in(item->string, midx_snapshot_ref_one, &data); > + data.preferred = 0; > + } > + > + for_each_ref(midx_snapshot_ref_one, &data); One small thing here - I think "data.preferred = 0;" needs to be moved to right above this for_each_ref line. As it is, if preferred is NULL, data.preferred wouldn't be initialized. Other than that (and the minor changes I've suggested in previous patches), this series looks good to me.