summaryrefslogtreecommitdiff
path: root/t/t4013/diff.log_--root_--patch-with-stat_master
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:29:21 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:56 -0700
commit98fa0d50a75099df3f2d62f9181e4c1bbf70f063 (patch)
tree44ca79a4ad52cd7029e8caca95ecf29f8895570f /t/t4013/diff.log_--root_--patch-with-stat_master
parent3d2ac2065e2ac230c92cb87cc46053a0f3db1616 (diff)
repack: move `find_pack_prefix()` out of the builtin
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. This avoids the callers having to do some prep work that is common between the two of them, but also avoids the potential pitfall of accidentally writing: .pack_prefix = find_pack_prefix(packtmp, packdir), (which is well-typed) when the caller meant to instead write: .pack_prefix = find_pack_prefix(packdir, packtmp), Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.log_--root_--patch-with-stat_master')
0 files changed, 0 insertions, 0 deletions