Skip to content

Commit 187574c

Browse files
jltoblergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 87c0100 commit 187574c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

bundle.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@ int unbundle(struct repository *r, struct bundle_header *header,
631631
struct unbundle_opts *opts)
632632
{
633633
struct child_process ip = CHILD_PROCESS_INIT;
634-
enum verify_bundle_flags flags = 0;
634+
struct unbundle_opts opts_fallback = { 0 };
635635

636-
if (opts)
637-
flags = opts->flags;
636+
if (!opts)
637+
opts = &opts_fallback;
638638

639-
if (verify_bundle(r, header, flags))
639+
if (verify_bundle(r, header, opts->flags))
640640
return -1;
641641

642642
strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
@@ -645,8 +645,9 @@ int unbundle(struct repository *r, struct bundle_header *header,
645645
if (header->filter.choice)
646646
strvec_push(&ip.args, "--promisor=from-bundle");
647647

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 : "");
650651

651652
if (extra_index_pack_args)
652653
strvec_pushv(&ip.args, extra_index_pack_args->v);

bundle.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header,
4141

4242
struct unbundle_opts {
4343
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;
4451
};
4552

4653
/**

0 commit comments

Comments
 (0)