From: Karthik Nayak Date: Thu, 10 Sep 2026 11:00:46 GMT Subject: Re: [PATCH v4 6/9] builtin/clone: move setup of alternates for non-shared local clones Message-ID: In-Reply-To: <20260909-pks-odb-write-alternates-at-creation-time-v4-6-d8a78ffc32e4@pks.im> Patrick Steinhardt writes: > Similar as in the preceding commit, move the setup of alternates for > local clones with "--no-shared" into `collect_alternates()`. With this > step, the complete setup of alternates is now handled by that function. > > Note that besides moving stuff around, it also fixes a bug: previously, > we did not know to resolve the referenced repository's common directory. > Consequently, when referencing a worktree we failed to resolve > alternates. But as `collect_alternates()` already knows to resolve the > commondir for "--local" we can simply reuse this resolved path for our > purpose. > > Add two tests, the first one of which exercises this bug to avoid future > regressions. The second test ensures that we properly handle relative > alternates for a referenced worktree. [snip] > static void collect_alternates(struct strvec *alternates, > @@ -242,6 +254,8 @@ static void collect_alternates(struct strvec *alternates, > get_common_dir(&commondir, src_repo); > if (option_shared) > strvec_pushf(alternates, "%s/objects", commondir.buf); > + else > + read_alternates(alternates, commondir.buf); > Okay so this is why we did what we did in the prev patch. Makes sense. > strbuf_release(&commondir); > } [snip]