From: Toon Claes Date: Fri, 28 Aug 2026 14:52:30 GMT Subject: Re: [PATCH 4/8] builtin/clone: move setup of alternates for shared local clones Message-ID: <875x0uuwk1.fsf@emacs.iotcl.com> In-Reply-To: <20260825-pks-odb-write-alternates-at-creation-time-v1-4-911513ba95c3@pks.im> Patrick Steinhardt writes: > diff --git a/builtin/clone.c b/builtin/clone.c > index 8eae3ac7d9..08c8f5a94f 100644 > --- a/builtin/clone.c > +++ b/builtin/clone.c > @@ -220,7 +220,8 @@ static void copy_alternates(struct strbuf *src, const char *src_repo) > fclose(in); > } > > -static void collect_alternates(struct strvec *alternates) > +static void collect_alternates(struct strvec *alternates, > + const char *src_repo, bool is_local) > { > if (option_required_reference.nr || option_optional_reference.nr) { > struct add_one_alternate_data data = { > @@ -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) { > + struct strbuf commondir = STRBUF_INIT; > + > + get_common_dir(&commondir, src_repo); > + if (option_shared) > + strvec_pushf(alternates, "%s/objects", commondir.buf); Also the use of `commondir` seems to be only used if option_shared is set, but it will be used in an else in a subsequential commit. > + > + strbuf_release(&commondir); > + } > } -- Laters, Toon