Thread (41 messages) 41 messages, 3 authors, 2025-12-11

Re: [PATCH 2/8] odb: resolve relative alternative paths when parsing

From: Patrick Steinhardt <hidden>
Date: 2025-12-09 08:04:25

On Mon, Dec 08, 2025 at 08:09:30PM -0600, Justin Tobler wrote:
On 25/12/08 09:04AM, Patrick Steinhardt wrote:
quoted
Parsing alternates and resolving potential relative paths is currently
handled in two separate steps. This has the effect that the logic to
retrieve alternates is not entirely self-contained. We want it to be
just that though so that we can eventually move the logic to list
alternates into the `struct odb_source`.
Naive question: is the intent here to eventually move alternate ODB
sources under the primary ODB source? Or just to record the alternate
dir info in the ODB source?
Not only the primary ODB source, but into ODB sources in general as
alternates are recursive by nature.

The problem I am trying to solve is that ODB sources may not even have a
filesystem-local directory, but the way we use alternates recursively
very much assumes they do. I don't want to treat "files" sources
specially though and only recursively add their alternates. Instead, I
want to move the logic of enumerating alternates into the source so that
every source can have a different way of enumerating them that may or
may not use the filesystem.
quoted
Move the logic to resolve relative alternative paths into
`parse_alternates()`. Besides bringing us a step closer towards the
above goal, it also neatly separates concerns of generating the list of
alternatives and linking them into the object database.

Note that we ignore any errors when the relative path cannot be
resolved. This isn't really a change in behaviour though: if the path
cannot be resolved to a directory then `alt_odb_usable()` still knows to
bail out.

While at it, rename the function to `odb_add_source()` to more clearly
indicate what its intent is and to align it with modern terminology.
Alternates are indeed just additional ODB sources appended to the
sources list. IIUC though, doesn't this function only add alternate
sources? If so, maybe it would be better to use
`odb_add_alternate_source()`?
Hm, yeah, I think you're right. We still have the recursive nature at
the end of this series, so let's call it accordingly.

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help