From: Taylor Blau Date: Fri, 10 Jul 2026 22:40:35 GMT Subject: Re: [PATCH v2 4/8] pack-bitmap: iterate object sources when opening bitmaps Message-ID: In-Reply-To: <20260710-pks-odb-for-each-object-filter-v2-4-3710a9cc165a@pks.im> On Fri, Jul 10, 2026 at 10:48:56AM +0200, Patrick Steinhardt wrote: > When opening a bitmap for a repository we perform two steps: > > - We first look for a multi-pack index bitmap in any of the object > sources connected to the repository. > > - We then look for a packfile bitmap in any of the packfiles of any of > the object sources. > > Both of these steps thus iterate through object sources themselves, one > via `odb_prepare_alternates()` and one via `repo_for_each_pack()`. This > layout makes it hard to introduce a way to open the bitmap of one > specific object source, which is functionality that we'll require in a > subsequent commit. > > Reverse the loop so that we instead loop through all sources in the > outer loop, and then for each source we try to load its bitmap via > either the multi-pack index or via a packfile. This makes sense. An individual object store should be considered to have a bitmap in the abstract sense if it provides either a multi-pack bitmap (or an incremental multi-pack bitmap ), or a single-pack bitmap. > Note that this changes the precedence of bitmaps in one specific edge > case: when an earlier object source only has a packfile bitmap, but a > later source has a multi-pack index bitmap, we now pick the packfile > bitmap of the earlier source. Previously, a multi-pack index bitmap from > any source would have taken precedence over all packfile bitmaps. Given > that object sources are ordered such that the local source comes first, > this arguably is an improvement, as we now prefer local bitmaps over > bitmaps in alternates. Furthermore, we already warn about repositories > that have multiple bitmaps, so this setup is broken and thus arguably > not worth worrying about too much. Yeah, I think the existing behavior should be considered broken, so I think that this behavior change is a positive one. Thanks, Taylor