Re: [PATCH 42/49] repack: move `find_pack_prefix()` out of the builtin
From: Taylor Blau <hidden>
Date: 2025-10-15 21:19:50
On Wed, Oct 15, 2025 at 06:32:20AM -0400, Jeff King wrote:
On Sun, Sep 28, 2025 at 06:10:02PM -0400, Taylor Blau wrote:quoted
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.
;-). Thanks, Taylor