bundle: add bundle verification options type

When `unbundle()` is invoked, fsck verification may be configured by
passing the `VERIFY_BUNDLE_FSCK` flag. This mechanism allows fsck checks
on the bundle to be enabled or disabled entirely. To facilitate more
fine-grained fsck configuration, additional context must be provided to
`unbundle()`.

Introduce the `unbundle_opts` type, which wraps the existing
`verify_bundle_flags`, to facilitate future extension of `unbundle()`
configuration. Also update `unbundle()` and its call sites to accept
this new options type instead of the flags directly. The end behavior is
functionally the same, but allows for the set of configurable options to
be extended. This is leveraged in a subsequent commit to enable fsck
message severity configuration.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Justin Tobler
2024-11-27 17:33:09 -06:00
committed by Junio C Hamano
parent 4083a6f052
commit 87c01003cd
5 changed files with 22 additions and 9 deletions

View File

@ -628,9 +628,13 @@ out:
int unbundle(struct repository *r, struct bundle_header *header,
int bundle_fd, struct strvec *extra_index_pack_args,
enum verify_bundle_flags flags)
struct unbundle_opts *opts)
{
struct child_process ip = CHILD_PROCESS_INIT;
enum verify_bundle_flags flags = 0;
if (opts)
flags = opts->flags;
if (verify_bundle(r, header, flags))
return -1;