v4 adds a new patch, 2/5, which makes the hashmap related functions in refs.c generic, so I could add a new map for worktree ref stores and not abuse submodule hashmap. I mentioned about moving these hashmap back to submodule.c and worktree.c where it can map more than just ref stores (in worktree case, we can cache 'struct worktree', for example). But I'm not doing it now to keep things small. The commit message in 1/5 is rephrased a bit, hopefully clearer. Nguyễn Thái Ngọc Duy (5): environment.c: fix potential segfault by get_git_common_dir() refs.c: make submodule ref store hashmap generic refs: introduce get_worktree_ref_store() worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe() refs: kill set_worktree_head_symref() branch.c | 15 ++--- environment.c | 2 + refs.c | 95 +++++++++++++++++++----------- refs.h | 12 +--- refs/files-backend.c | 44 -------------- t/helper/test-ref-store.c | 18 ++++++ t/t1407-worktree-ref-store.sh (new +x) | 52 +++++++++++++++++ worktree.c | 102 +++++++++------------------------ worktree.h | 2 +- 9 files changed, 173 insertions(+), 169 deletions(-) create mode 100755 t/t1407-worktree-ref-store.sh -- 2.11.0.157.gd943d85