Re: [PATCH v2] builtin/repack.c: remove redundant pack-based bitmaps
- From
Jeff King <peff@peff.net>
- Date
- Oct 18, 2022, 06:29 UTC
- Message-ID
- <Y05HrVT9HxxDiXc2@coredump.intra.peff.net>
- In-Reply-To
- <1e0ef7ee7ff5feb323c77e594cd65433fb1d99f7.1666061096.git.me@ttaylorr.com>
On Mon, Oct 17, 2022 at 10:45:12PM -0400, Taylor Blau wrote:
Show 12 quoted lines
> When we write a MIDX bitmap after repacking, it is possible that the > repository would be left in a state with both pack- and multi-pack > reachability bitmaps. > > This can occur, for instance, if a pack that was kept (either by having > a .keep file, or during a geometric repack in which it is not rolled up) > has a bitmap file, and the repack wrote a multi-pack index and bitmap. > > When loading a reachability bitmap for the repository, the multi-pack > one is always preferred, so the pack-based one is redundant. Let's > remove it unconditionally, even if '-d' isn't passed, since there is no > practical reason to keep both around. The patch below does just that.
Thanks, this version looks great to me.
Show 9 quoted lines
> 1: 393fd4c6db ! 1: 1e0ef7ee7f builtin/repack.c: remove redundant pack-based bitmaps
> @@ builtin/repack.c: static int write_midx_included_packs(struct string_list *inclu
> + strbuf_addstr(&path, ".bitmap");
> +
> + if (unlink(path.buf) && errno != ENOENT)
> -+ die_errno(_("could not remove stale bitmap: %s"),
> -+ path.buf);
> ++ warning_errno(_("could not remove stale bitmap: %s"),
> ++ path.buf);As noted elsewhere in the thread, this could be unlink_or_warn(), but doing it manually lets us produce a more specific message, which is nice.
-Peff