From: Junio C Hamano Date: Mon, 12 Oct 2026 18:49:08 GMT Subject: Re: [PATCH v3 3/4] connected: add transfer.connectivityCheck config and rev-list flag Message-ID: In-Reply-To: "Kristofer Karlsson via GitGitGadget" writes: > diff --git a/connected.c b/connected.c > index 929b9bd28d..e3dcd8e2b0 100644 > --- a/connected.c > +++ b/connected.c > @@ -1,6 +1,7 @@ > #define USE_THE_REPOSITORY_VARIABLE > > #include "git-compat-util.h" > +#include "config.h" > #include "gettext.h" > #include "hex.h" > #include "odb.h" > @@ -67,6 +68,26 @@ static int check_connected_promisor(oid_iterate_fn fn, > return 1; > } > > +static int incremental_check_applicable(struct check_connected_options *opt) > +{ > + const char *algorithm = NULL; > + > + if (repo_config_get_string_tmp(the_repository, > + "transfer.connectivitycheck", > + &algorithm)) > + return 0; The file does declare USE_THE_REPOSITORY_VARIABLE but I wonder if we can easily reduce the dependency to the_repository by adding "struct repository *repo" pointer to the check_connected_options structure and using it here and passing it to check_connected_promisor() which is a file-scope static nearby. > + if (!strcasecmp(algorithm, "full")) > + return 0; > + if (strcasecmp(algorithm, "incremental")) > + die(_("unknown transfer.connectivityCheck algorithm '%s'"), > + algorithm); > + > + if (opt->is_deepening_fetch) > + return 0; > + > + return 1; > +} > + > /* > * If we feed all the commits we want to verify to this command > * > @@ -133,6 +154,9 @@ int check_connected(oid_iterate_fn fn, void *cb_data, > if (opt->progress) > strvec_pushf(&rev_list.args, "--progress=%s", > _("Checking connectivity")); > + if (incremental_check_applicable(opt)) > + strvec_push(&rev_list.args, > + "--verify-trees-incremental"); > > rev_list.git_cmd = 1; > if (opt->env)