aboutsummaryrefslogtreecommitdiffstats
path: root/transport.c
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2024-11-27 17:33:09 -0600
committerJunio C Hamano <gitster@pobox.com>2024-11-28 12:07:57 +0900
commit87c01003cdff8c99ebdf053441e4527d85952284 (patch)
tree8e1bb2e501c1f1391f53844f8c77b665d38ba5b0 /transport.c
parent4083a6f05206077a50af7658bedc17a94c54607d (diff)
downloadgit-87c01003cdff8c99ebdf053441e4527d85952284.tar.gz
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>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/transport.c b/transport.c
index 47fda6a773..8536b14181 100644
--- a/transport.c
+++ b/transport.c
@@ -176,6 +176,9 @@ static int fetch_refs_from_bundle(struct transport *transport,
int nr_heads UNUSED,
struct ref **to_fetch UNUSED)
{
+ struct unbundle_opts opts = {
+ .flags = fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0,
+ };
struct bundle_transport_data *data = transport->data;
struct strvec extra_index_pack_args = STRVEC_INIT;
int ret;
@@ -186,8 +189,7 @@ static int fetch_refs_from_bundle(struct transport *transport,
if (!data->get_refs_from_bundle_called)
get_refs_from_bundle_inner(transport);
ret = unbundle(the_repository, &data->header, data->fd,
- &extra_index_pack_args,
- fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0);
+ &extra_index_pack_args, &opts);
transport->hash_algo = data->header.hash_algo;
strvec_clear(&extra_index_pack_args);