Michael Haggerty <mhagger@xxxxxxxxxxxx> writes: > Move the responsibility for registering the ref_store for a submodule > from base_ref_store_init() to a new function, register_ref_store(). Call > the latter from ref_store_init(). > > This means that base_ref_store_init() can lose its submodule argument, > further weakening the 1:1 relationship between ref_stores and > submodules. OK. I think I am starting to get it. I've always found it disturbing that for_each_*ref*() has a "submodule" variant. Instead, the plan (outlined in the discussion from yesterday that triggered your posting this series) is to give an API to request a "ref-store", and then ask that object to iterate over refs, and these steps get us closer to that goal, because the "to enumerate these" won't have to know what set of refs a ref-store contains. If you want to iterate over refs in a submodule, you grab a ref-store for the submodule and ask it to iterate. Iterating over refs in another worktree, you grab a different ref-store and ask it to iterate using the same API. Sounds like a good direction to go.