summaryrefslogtreecommitdiffstats
path: root/bundle-uri.c
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2024-11-28 00:33:09 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-28 04:07:57 +0100
commit87c01003cdff8c99ebdf053441e4527d85952284 (patch)
tree8e1bb2e501c1f1391f53844f8c77b665d38ba5b0 /bundle-uri.c
parentSync with 'maint' (diff)
downloadgit-87c01003cdff8c99ebdf053441e4527d85952284.tar.xz
git-87c01003cdff8c99ebdf053441e4527d85952284.zip
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 'bundle-uri.c')
-rw-r--r--bundle-uri.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bundle-uri.c b/bundle-uri.c
index 0df66e2872..cdf9e4f9e1 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -367,6 +367,10 @@ static int unbundle_from_file(struct repository *r, const char *file)
struct string_list_item *refname;
struct strbuf bundle_ref = STRBUF_INIT;
size_t bundle_prefix_len;
+ struct unbundle_opts opts = {
+ .flags = VERIFY_BUNDLE_QUIET |
+ (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0),
+ };
bundle_fd = read_bundle_header(file, &header);
if (bundle_fd < 0) {
@@ -379,8 +383,7 @@ static int unbundle_from_file(struct repository *r, const char *file)
* a reachable ref pointing to the new tips, which will reach
* the prerequisite commits.
*/
- result = unbundle(r, &header, bundle_fd, NULL,
- VERIFY_BUNDLE_QUIET | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0));
+ result = unbundle(r, &header, bundle_fd, NULL, &opts);
if (result) {
result = 1;
goto cleanup;