git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] register_ref_store(): new function

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2017, 21:16 UTC
Message-ID
<xmqq8tpfoyid.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<ce326e17822184eff434b957d28f2233795162db.1486629195.git.mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 7 quoted lines
> 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.
Previous: Michael HaggertyNext: Michael Haggerty
Message 5 of 28 in “Store submodules in a hash, not a linked list”
  1. 0/5 Store submodules in a hash, not a linked listMichael Haggerty, Feb 9, 2017
  2. 3/5 register_ref_store(): new functionMichael Haggerty, Feb 9, 2017
  3. Stefan BellerFeb 9, 2017
  4. Michael HaggertyFeb 9, 2017
  5. Junio C HamanoFeb 9, 2017
  6. 1/5 refs: store submodule ref stores in a hashmapMichael Haggerty, Feb 9, 2017
  7. Stefan BellerFeb 9, 2017
  8. Michael HaggertyFeb 9, 2017
  9. Stefan BellerFeb 9, 2017
  10. Jeff KingFeb 9, 2017
  11. Junio C HamanoFeb 9, 2017
  12. Jeff KingFeb 10, 2017
  13. Michael HaggertyFeb 10, 2017
  14. 4/5 files_ref_store::submodule: use NULL for the main repositoryMichael Haggerty, Feb 9, 2017
  15. Stefan BellerFeb 9, 2017
  16. Junio C HamanoFeb 9, 2017
  17. Stefan BellerFeb 9, 2017
  18. 5/5 read_loose_refs(): read refs using resolve_ref_recursively()Michael Haggerty, Feb 9, 2017
  19. Stefan BellerFeb 9, 2017
  20. 2/5 refs: push the submodule attribute downMichael Haggerty, Feb 9, 2017
  21. Stefan BellerFeb 9, 2017
  22. Junio C HamanoFeb 9, 2017
  23. Junio C HamanoFeb 9, 2017
  24. Jeff KingFeb 9, 2017
  25. Michael HaggertyFeb 9, 2017
  26. Jeff KingFeb 10, 2017
  27. Michael HaggertyFeb 10, 2017
  28. Duy NguyenFeb 13, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.