Re: [PATCH 2/2] odb: use odb_source_files_try() in source-chain iterations
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 19, 2026, 10:05 UTC
- Message-ID
- <abvKgsCe1V5g6c0s@pks.im>
- In-Reply-To
- <a8303b1427a41fd4b3ca107eabc49e8ac6d02410.1773674983.git.gitgitgadget@gmail.com>
On Mon, Mar 16, 2026 at 03:29:43PM +0000, Aaron Paterson via GitGitGadget wrote:
Show 5 quoted lines
> From: Aaron Paterson <apaterson@pm.me> > > 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.
Show 6 quoted lines
> 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