From: Karthik Nayak Date: Thu, 10 Sep 2026 19:53:21 GMT Subject: Re: [PATCH v5 0/9] odb: write alternates at creation time Message-ID: In-Reply-To: <20260910-pks-odb-write-alternates-at-creation-time-v5-0-8d10c4238edc@pks.im> Patrick Steinhardt writes: > Hi, > > writing alternates into the object database currently happens via > `odb_source_write_alternate()`. But while that creates the ability to > create alternates at arbitrary points of a source's lifetime, we don't > use that functionality in the first place. Instead, we only ever write > alternates when creating a new repository. > > This design is suboptimal due to a couple of reasons: > > - It requires us to have a `write_alternates()` callback, which is > overblown as we never even write alternates to an object database > after it has been created. > > - We're about to make alternates an implementation detail of the > object database's backend in a future patch series, so alternate > implementations may not even support them. > > - The backend has more flexibility with how exactly alternates are > configured when it itself is in full control over their setup at the > time where it creates the object database itself. > > This patch series thus refactors how we handle alternates so that we > don't write them ad-hoc anymore. Instead, the series introduces a new > option for `odb_source_create_on_disk()` that makes it handle those > alternates at creation time. > > This is part of the bigger goal of moving handling of alternates into > the "files" backend. > > This series is built on top of 2c3adbb2c4 (The 18th batch, 2026-08-24) > with ps/odb-eagerly-load-alternates at 0076dc9f81 (odb: drop > `alternates_db` field, 2026-08-17) merged into it. > > Changes in v5: > - Rename `add_one_alternate` and `add_one_alternate_data` to > `collect_one_alternate` and `collect_alternates_data` to clarify > their intent a bit. > - Drop extra parameter in `collect_alternates()`. > - Clarify why we compute `commondir` even though it's unused. > - Link to v4: https://patch.msgid.link/20260909-pks-odb-write-alternates-at-creation-time-v4-0-d8a78ffc32e4@pks.im > Looks like you missed my comment/question in CAOLa=ZQaPstiQmXm9=TyWPUxL6X2=Lcqeg6y2XeXzSJDpq-GBA@mail.gmail.com, but otherwise looks good :) [snip]