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

[PATCH 0/5] Store submodules in a hash, not a linked list

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 9, 2017, 13:26 UTC
Message-ID
<cover.1486629195.git.mhagger@alum.mit.edu>

I have mentioned this patch series on the mailing list a couple of time [1,2] but haven't submitted it before. I just rebased it to current master. It is available from my Git fork [3] as branch "submodule-hash".

The first point of this patch series is to optimize submodule `ref_store` lookup by storing the `ref_store`s in a hashmap rather than a linked list. But a more interesting second point is to weaken the 1:1 relationship between submodules and `ref_stores` a little bit more.

A `files_ref_store` would be perfectly happy to represent, say, the references *physically* stored in a linked worktree (e.g., `HEAD`, `refs/bisect/*`, etc) even though that is not the complete collection of refs that are *logically* visible from that worktree (which includes references from the main repository, too). But the old code was confusing the two things by storing "submodule" in every `ref_store` instance.

So push the submodule attribute down to the `files_ref_store` class (but continue to let the `ref_store`s be looked up by submodule).

The last commit is relatively orthogonal to the others; it simplifies read_loose_refs() by calling resolve_ref_recursively() directly using the `ref_store` instance that it already has in hand, rather than indirectly via the public wrappers.

Michael

[1] http://public-inbox.org/git/341999fc-4496-b974-c117-c18a2fca1358@alum.mit.edu/ [2] http://public-inbox.org/git/37fe2024-0378-a974-a28d-18a89d3e2312@alum.mit.edu/ [3] https://github.com/mhagger/git

Michael Haggerty (5):
  refs: store submodule ref stores in a hashmap
  refs: push the submodule attribute down
  register_ref_store(): new function
  files_ref_store::submodule: use NULL for the main repository
  read_loose_refs(): read refs using resolve_ref_recursively()
 refs.c               | 93 ++++++++++++++++++++++++++++++++++------------------
 refs/files-backend.c | 77 +++++++++++++++++++++++++------------------
 refs/refs-internal.h | 37 ++++++++-------------
 3 files changed, 122 insertions(+), 85 deletions(-)
-- 
2.9.3
Next: Michael Haggerty
Message 1 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.