Re: [PATCH v2 8/8] builtin/repack.c: pass `--refs-snapshot` when writing bitmaps
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Sep 24, 2021, 18:22 UTC
- Message-ID
- <20210924182247.2922561-1-jonathantanmy@google.com>
- In-Reply-To
- <eb24b308ecdbd7736fc63927130540abd0a668db.1631730270.git.me@ttaylorr.com>
Show 22 quoted lines
> +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.