bundle: support fsck message configuration
If the `VERIFY_BUNDLE_FLAG` is set during `unbundle()`, the git-index-pack(1) spawned is configured with the `--fsck-options` flag to perform fsck verification. With this flag enabled, there is not a way to configure fsck message severity though. Extend the `unbundle_opts` type to store fsck message severity configuration and update `unbundle()` to conditionally append it to the `--fsck-objects` flag if provided. This enables `unbundle()` call sites to support optionally setting the severity for specific fsck messages. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Justin Tobler committed
Nov 27, 2024 at 17:33 UTC
187574ce869f1244de83fc6a0a5b6d614fe979f2
2 files changed
+14
-6
bundle.c
+7
-6
@@ -631,12 +631,12 @@ int unbundle(struct repository *r, struct bundle_header *header,
631
struct unbundle_opts *opts)
632
{
633
struct child_process ip = CHILD_PROCESS_INIT;
634
- enum verify_bundle_flags flags = 0;
634
+ struct unbundle_opts opts_fallback = { 0 };
635
636
- if (opts)
637
- flags = opts->flags;
636
+ if (!opts)
637
+ opts = &opts_fallback;
638
639
- if (verify_bundle(r, header, flags))
639
+ if (verify_bundle(r, header, opts->flags))
640
return -1;
641
642
strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
@@ -645,8 +645,9 @@ int unbundle(struct repository *r, struct bundle_header *header,
645
if (header->filter.choice)
646
strvec_push(&ip.args, "--promisor=from-bundle");
647
648
- if (flags & VERIFY_BUNDLE_FSCK)
649
- strvec_push(&ip.args, "--fsck-objects");
648
+ if (opts->flags & VERIFY_BUNDLE_FSCK)
649
+ strvec_pushf(&ip.args, "--fsck-objects%s",
650
+ opts->fsck_msg_types ? opts->fsck_msg_types : "");
651
652
if (extra_index_pack_args)
653
strvec_pushv(&ip.args, extra_index_pack_args->v);
bundle.h
+7
@@ -41,6 +41,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header,
41
42
struct unbundle_opts {
43
enum verify_bundle_flags flags;
44
+ /*
45
+ * fsck_msg_types may optionally contain fsck message severity
46
+ * configuration. If present, this configuration gets directly appended
47
+ * to a '--fsck-objects' option and therefore must be prefixed with '='.
48
+ * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore")
49
+ */
50
+ const char *fsck_msg_types;
51
};
52
53
/**