Skip to content

Store submodules in a hash, not a linked list

Michael Haggerty git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 8 repliesIn review
  2. v15 patches 22 repliesSuperseded

Changes in v2 from the cover letter

* Rebase from master onto maint (to match Junio).

* Reorder some commits to make the presentation more logical.

* Added an explicit preparatory commit that just reorders some function definitions, because it makes the diff for the subsequent commit a lot easier to read.

* Make some preexisting functions private:
* lookup_ref_store()
* ref_store_init()

* Remove some unnecessary handling of submodule == "" when it is already known to have been converted to NULL. (Some of the purported handling also happened to be broken.)

* Introduce function register_ref_store() in a separate step, before switching to hashmaps.

* Don't initialize hashmap in lookup_ref_store(). (Just return NULL; the hashmap will be initialized in register_ref_store() a moment later.)

* Make code in submodule_hash_cmp() clearer.

* Use FLEX_ALLOC_STR() in alloc_submodule_hash_entry().

* Don't specify an initial size for the submodule hashmap (the default is OK).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9refs: reorder some function definitionsrefs.c+32 -321 reply
2/9refs: make some ref_store lookup functions privaterefs.c refs/refs-internal.h+17 -210 replies
3/9refs: remove some unnecessary handling of submodule == ""refs.c+2 -110 replies
4/9register_ref_store(): new functionrefs.c+29 -140 replies
5/9refs: store submodule ref stores in a hashmaprefs.c refs/refs-internal.h+45 -190 replies
6/9refs: push the submodule attribute downrefs.c refs/files-backend.c refs/refs-internal.h+43 -420 replies
7/9base_ref_store_init(): remove submodule argumentrefs.c refs/files-backend.c refs/refs-internal.h+5 -70 replies
8/9files_ref_store::submodule: use NULL for the main repositoryrefs/files-backend.c+8 -80 replies
9/9read_loose_refs(): read refs using resolve_ref_recursively()refs.c refs/files-backend.c refs/refs-internal.h+34 -393 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/9] Store submodules in a hash, not a linked list

This is v2 of the patch series, considerably reorganized but not that different codewise. Thanks to Stefan, Junio, and Peff for their feedback about v1 [1]. I think I have addressed all of your comments.

Changes since v1:

* Rebase from master onto maint (to match Junio).

* Reorder some commits to make the presentation more logical.

* Added an explicit preparatory commit that just reorders some function definitions, because it makes the diff for the subsequent commit a lot easier to read.

* Make some preexisting functions private:
* lookup_ref_store()
* ref_store_init()

* Remove some unnecessary handling of submodule == "" when it is already known to have been converted to NULL. (Some of the purported handling also happened to be broken.)

* Introduce function register_ref_store() in a separate step, before switching to hashmaps.

* Don't initialize hashmap in lookup_ref_store(). (Just return NULL; the hashmap will be initialized in register_ref_store() a moment later.)

* Make code in submodule_hash_cmp() clearer.

* Use FLEX_ALLOC_STR() in alloc_submodule_hash_entry().

* Don't specify an initial size for the submodule hashmap (the default is OK).

This patch series is also available from my fork on GitHub [2] as branch "submodule-hash".

Michael

[1] http://public-inbox.org/git/[email protected]/T/#u
[2] https://github.com/mhagger/git

Michael Haggerty (9):
refs: reorder some function definitions
refs: make some ref_store lookup functions private
refs: remove some unnecessary handling of submodule == "" register_ref_store(): new function
refs: store submodule ref stores in a hashmap
refs: push the submodule attribute down base_ref_store_init(): remove submodule argument files_ref_store::submodule: use NULL for the main repository read_loose_refs(): read refs using resolve_ref_recursively()

 refs.c               | 107 +++++++++++++++++++++++++++++++++++----------------
 refs/files-backend.c |  77 +++++++++++++++++++++---------------
 refs/refs-internal.h |  48 ++++-------------------
 3 files changed, 127 insertions(+), 105 deletions(-)
Signature · 1 line
2.9.3