This is on top of mh/submodule-hash, it: - centralizes path manipulation around submodule, $GIT_DIR... in files-backend.c to a new function files_path() with the intention to make it easier to change later. files_path() is destined to become strbuf_addbuf(&sb, refs->gitdir); strbuf_complete(&sb, '/'); strbuf_vaddf(&sb, fmt, vap); but that can only be achieved once we get compound ref store. - removes git_path() and submodule_git_path() from files-backend.c. No more magic path translation as far as ref backend is concerned. - moves submodule path resolution code outside the backend. files-backend is now oblivious of submodules and in theory a submodule ref-store supports all operations (but I could be wrong, I didn't stare hard) - exposes get_submodule_ref_store() and get_main_ref_store() as public API. A new set of API around ref-store will be added. And get_worktree_ref_store() of course. The *_submodule() API might be removed, we'll see. The problem with set_worktree_head_symref() (which peeks into another gitdir) should be solved once we have get_worktree_ref_store(). That's my next step. Compound ref store will have to wait until I'm done with my gc-in-worktree problem as I think I can live without it for now. I think after compound ref store is in place, adding lmdb backend back should be much cleaner because it does not care about either submodules or worktrees. Nguyễn Thái Ngọc Duy (11): refs-internal.c: make files_log_ref_write() static files-backend: convert git_path() to strbuf_git_path() files-backend: add files_path() files-backend: replace *git_path*() with files_path() refs.c: share is_per_worktree_ref() to files-backend.c refs-internal.h: correct is_per_worktree_ref() files-backend: remove the use of git_path() refs.c: factor submodule code out of get_ref_store() refs: move submodule code out of files-backend.c files-backend: remove submodule_allowed from files_downcast() refs: split and make get_*_ref_store() public API refs.c | 125 ++++++++++++------ refs.h | 13 ++ refs/files-backend.c | 350 ++++++++++++++++++++++++++++++--------------------- refs/refs-internal.h | 28 ++--- 4 files changed, 316 insertions(+), 200 deletions(-) -- 2.11.0.157.gd943d85