Re: [PATCH v4 5/6] connected: add incremental connectivity check via rev-list
- From
Kristofer Karlsson <krka@spotify.com>
- Date
- Oct 22, 2026, 07:00 UTC
- Message-ID
- <CAL71e4Pe_NRxeu9_+pnp=pBOk3SBNyePUbT5DDtDhd1bJpwJng@mail.gmail.com>
- In-Reply-To
- <xmqqecdin6xr.fsf@gitster.g>
On Wed, 21 Oct 2026 at 22:18, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
>
> "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > -static void parse_connectivity_check(struct repository *repo UNUSED,
> > +static void parse_connectivity_check(struct repository *repo,
> > const char *arg,
> > struct connectivity_check *check)
> > {
> > if (!strcmp(arg, "full"))
> > check->mode = CONNECTIVITY_CHECK_FULL;
> > + else if (!strcmp(arg, "incremental"))
> > + check->mode = CONNECTIVITY_CHECK_INCREMENTAL;
> > else
> > die(_("unknown --connectivity-check mode '%s'"), arg);
> > +
> > + if (check->mode != CONNECTIVITY_CHECK_FULL)
> > + repo->fetch_if_missing = 0;
> > }
>
> This assumes that everybody that is different from full want to
> avoid lazy fetching. It may be true right now as you have only full
> and incremental, but it somehow feels like a trap waiting to bite
> future developers.Good point, and I think I could simplify this to always set fetch_if_missing = 0 for any type of connectivity check, since no connectivity check should be allowed to trigger remote calls.
I think the reason this was not in place before was that rev-list did not know that the intent was a connectivity check but now by passing this new --connectivity-check it always does.
Show 16 quoted lines
> > +static int verify_blob(struct repository *repo,
> > + const struct object_id *oid,
> > + struct verify_state *vs)
> > +{
> > + int type;
> > +
> > + if (oidset_contains(&vs->trusted_blobs, oid))
> > + return 0;
> > +
> > + vs->blobs_checked++;
> > + type = odb_read_object_info(repo->objects, oid, NULL);
>
> I wonder if this needs to be _extended() kind that passes a flag bit
> to avoid fetching from promisors. repo->fetch_if_missing that is
> set does prevent lazy fetching, but I wonder if it is better to be
> more explicit.Yes, and an earlier internal prototype (that I never sent) did this. Blob and tree reads are easy to switch to odb_read_object_info_extended() with OBJECT_INFO_SKIP_FETCH_OBJECT, but parsing the parent commits goes through repo_parse_commit_gently(), which has no such flag. That would need a no-fetch flag passed down through commit parsing, which I think is not too bad on its own.
But even then, the revision walk around the verifier and the full check would still depend on fetch_if_missing, so the verifier alone would not let us drop it. I think it is better to refactor that all at once in a separate follow-up, since this series is already big enough. However, if you would prefer to have it now already, I could try to add a new commit on top for the next reroll.
(My earlier prototype was more complex because it ran in-process rather than via rev-list, so it also had to avoid die(), which triggered even more low level function changes. That does not apply here though, fortunately.)
Thanks for the review, Kristofer