Re: [PATCH 42/49] repack: move `find_pack_prefix()` out of the builtin
From: Jeff King <hidden>
Date: 2025-10-15 10:32:21
On Sun, Sep 28, 2025 at 06:10:02PM -0400, Taylor Blau wrote:
Both callers within the repack builtin which call functions that take a
'write_pack_opts' structure have the following pattern:
struct write_pack_opts opts = {
.packdir = packdir,
.packtmp = packtmp,
.pack_prefix = find_pack_prefix(packdir, packtmp),
/* ... */
};
int ret = write_some_kind_of_pack(&opts, /* ... */);
, but both "packdir" and "packtmp" are fields within the write_pack_opts
struct itself!
Instead of also computing the pack_prefix ahead of time, let's have the
callees compute it themselves by moving `find_pack_prefix()` out of the
repack builtin, and have it take a write_pack_opts pointer instead of
the "packdir" and "packtmp" fields directly.Oh. You'd really think by now that I'd have learned to read ahead in the series before commenting. So you can ignore my responses to the previous two patches. This does what I propose, plus takes it further by using the opts struct itself. -Peff