Message ID | 20241127005707.319881-3-jltobler@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | propagate fsck message severity for bundle fetch | expand |
On Tue, Nov 26, 2024 at 06:57:05PM -0600, Justin Tobler wrote: > diff --git a/bundle.c b/bundle.c > index 485033ea3f..4e53ddfca2 100644 > --- a/bundle.c > +++ b/bundle.c > @@ -631,12 +631,12 @@ int unbundle(struct repository *r, struct bundle_header *header, > struct unbundle_opts *opts) > { > struct child_process ip = CHILD_PROCESS_INIT; > - enum verify_bundle_flags flags = 0; > + struct unbundle_opts opts_fallback = { 0 }; > > - if (opts) > - flags = opts->flags; > + if (!opts) > + opts = &opts_fallback; Tiny nit: you could've introduced the fallback in the first commit already. Like this you first introduce the code pattern and then change it immediately in the subsequent commit. Not worth a reroll though. > diff --git a/bundle.h b/bundle.h > index 6a09cc7bfb..df17326b09 100644 > --- a/bundle.h > +++ b/bundle.h > @@ -41,6 +41,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header, > > struct unbundle_opts { > enum verify_bundle_flags flags; > + /** Nit: s|/**/|/*| Again, not worth a reroll from my point of view, also with the recent discussion at <877c8yti5n.fsf@iotcl.com> in mind where we basically went "We don't care about them". Patrick
diff --git a/bundle.c b/bundle.c index 485033ea3f..4e53ddfca2 100644 --- a/bundle.c +++ b/bundle.c @@ -631,12 +631,12 @@ int unbundle(struct repository *r, struct bundle_header *header, struct unbundle_opts *opts) { struct child_process ip = CHILD_PROCESS_INIT; - enum verify_bundle_flags flags = 0; + struct unbundle_opts opts_fallback = { 0 }; - if (opts) - flags = opts->flags; + if (!opts) + opts = &opts_fallback; - if (verify_bundle(r, header, flags)) + if (verify_bundle(r, header, opts->flags)) return -1; strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL); @@ -645,8 +645,9 @@ int unbundle(struct repository *r, struct bundle_header *header, if (header->filter.choice) strvec_push(&ip.args, "--promisor=from-bundle"); - if (flags & VERIFY_BUNDLE_FSCK) - strvec_push(&ip.args, "--fsck-objects"); + if (opts->flags & VERIFY_BUNDLE_FSCK) + strvec_pushf(&ip.args, "--fsck-objects%s", + opts->fsck_msg_types ? opts->fsck_msg_types : ""); if (extra_index_pack_args) strvec_pushv(&ip.args, extra_index_pack_args->v); diff --git a/bundle.h b/bundle.h index 6a09cc7bfb..df17326b09 100644 --- a/bundle.h +++ b/bundle.h @@ -41,6 +41,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header, struct unbundle_opts { enum verify_bundle_flags flags; + /** + * fsck_msg_types may optionally contain fsck message severity + * configuration. If present, this configuration gets directly appended + * to a '--fsck-objects' option and therefore must be prefixed with '='. + * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore") + */ + const char *fsck_msg_types; }; /**
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> --- bundle.c | 13 +++++++------ bundle.h | 7 +++++++ 2 files changed, 14 insertions(+), 6 deletions(-)