Re: [PATCH v2 1/8] midx: expose `write_midx_file_only()` publicly
From: Jonathan Tan <hidden>
Date: 2021-09-22 23:14:30
quoted hunk ↗ jump to hunk
@@ -1237,7 +1253,7 @@ static int write_midx_internal(const char *object_dir, QSORT(ctx.info, ctx.nr, pack_info_compare); - if (packs_to_drop && packs_to_drop->nr) { + if (ctx.m && packs_to_drop && packs_to_drop->nr) { int drop_index = 0; int missing_drops = 0;
I couldn't figure out why this requires ctx.m now.
quoted hunk ↗ jump to hunk
@@ -62,6 +63,10 @@ int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name) int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local); int write_midx_file(const char *object_dir, const char *preferred_pack_name, unsigned flags); +int write_midx_file_only(const char *object_dir, + struct string_list *packs_to_include, + const char *preferred_pack_name, + unsigned flags);
It took me a while to figure out that this function doesn't only write a MIDX file, but writes an MIDX file only for certain packs. Maybe worth adding a comment here (e.g. "Write an MIDX file only for the given packs"). Other than that, this patch looks good.