Subject: Re: [PATCH 2/2] odb: use odb_source_files_try() in source-chain iterations

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 19 Mar 2026 11:05:54 +0100

On Mon, Mar 16, 2026 at 03:29:43PM +0000, Aaron Paterson via GitGitGadget wrote:
> From: Aaron Paterson <[email-masked]>
> 
> Convert all source-chain iteration sites that access
> files-specific internals (pack store, loose cache, MIDX) to use
> odb_source_files_try() instead of odb_source_files_downcast().

I have to wonder what the motivation for this is. We don't have any
other sources (yet), and we're still in the process of bootstrapping
pluggable object databases. So it's expected that things won't fully
work yet that we'll die in lots of places if an alternate backend was in
use.

But the solution to this isn't to simply skip non-files backends, but
rather to adapt those sites so that they are properly abstracted.

> These loops iterate the full source chain, which may include
> alternates. When a non-files backend is added to the chain (as an
> alternate or additional source), these sites must skip it rather
> than abort. The _try() helper returns NULL for non-files sources,
> and each site checks for NULL before accessing files-specific
> members.

The big question here is whether skipping is actually the correct thing
to do, and in most cases I would claim it's probably not.

I'm a bit puzzled.

Patrick