From: Patrick Steinhardt Date: Thu, 10 Sep 2026 14:26:54 GMT Subject: Re: [PATCH v4 5/9] builtin/clone: move setup of alternates for shared local clones Message-ID: In-Reply-To: On Thu, Sep 10, 2026 at 05:54:50AM -0500, Karthik Nayak wrote: > Karthik Nayak writes: > > Patrick Steinhardt 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