]> git.ipfire.org Git - thirdparty/git.git/commit
midx-write.c: introduce `struct write_midx_opts`
authorTaylor Blau <me@ttaylorr.com>
Wed, 14 Jan 2026 19:54:42 +0000 (14:54 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Jan 2026 20:52:57 +0000 (12:52 -0800)
commitee9fe71928fab681bac2f584a249c11cd3052f03
tree053182b9a14aadf77a7d598f600eaea2ab5abf17
parent0de6662a17c9efc5ee5c9c497cb03411d2b9f7a8
midx-write.c: introduce `struct write_midx_opts`

In the MIDX writing code, there are four functions which perform some
sort of MIDX write operation. They are:

 - write_midx_file()
 - write_midx_file_only()
 - expire_midx_packs()
 - midx_repack()

All of these functions are thin wrappers over `write_midx_internal()`,
which implements the bulk of these routines. As a result, the
`write_midx_internal()` function takes six arguments.

Future commits in this series will want to add additional arguments, and
in general this function's signature will be the union of parameters
among *all* possible ways to write a MIDX.

Instead of adding yet more arguments to this function to support MIDX
compaction, introduce a `struct write_midx_opts`, which has the same
struct members as `write_midx_internal()`'s arguments.

Adding additional fields to the `write_midx_opts` struct is preferable
to adding additional arguments to `write_midx_internal()`. This is
because the callers below all zero-initialize the struct, so each time
we add a new piece of information, we do not have to pass the zero value
for it in all other call-sites that do not care about it.

For now, no functional changes are included in this patch.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c