Re: [PATCH v4 5/9] builtin/clone: move setup of alternates for shared local clones
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 10, 2026, 14:26 UTC
- Message-ID
- <aqK-Lh6HEU1BCbBf@pks.im>
- In-Reply-To
- <CAOLa=ZQLdB23c0b0tzUeYew=Gkqc11fLnROy0RUCUBg6qxxy4w@mail.gmail.com>
On Thu, Sep 10, 2026 at 05:54:50AM -0500, Karthik Nayak wrote:
Show 24 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
> > Patrick Steinhardt <ps@pks.im> writes:
> >> diff --git a/builtin/clone.c b/builtin/clone.c
> >> index 8786a49332..011fc867c8 100644
> >> --- a/builtin/clone.c
> >> +++ b/builtin/clone.c
> >> @@ -234,6 +235,16 @@ static void collect_alternates(struct strvec *alternates)
> >> for_each_string_list(&option_optional_reference,
> >> add_one_alternate, &data);
> >> }
> >> +
> >> + if (is_local) {
> >>
> >
> > Shouldn't we also check for `option_shared` here?
> >
> >> + struct strbuf commondir = STRBUF_INIT;
> >> +
> >> + get_common_dir(&commondir, src_repo);
> >> + if (option_shared)
> >> + strvec_pushf(alternates, "%s/objects", commondir.buf);
> >> +
>
> So we do it here, but then commondir is initiated but unused otherwise.It is, yes. But this is done to prep for the next step, where the `commondir` variable will be used regardless of whether or not we use `option_shared`.
I'll adapt the commit message a bit.
Patrick