Subject: [PATCH v2 00/16] Remove submodule from files-backend.c

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Thu, 16 Feb 2017 18:48:02 +0700

Changes in v2:

 - should fix all feedbacks I've got in v1
 - rebased on mh/submodule-hash v2
 - share the "submodule -> gitdir" code that I copied from
   strbuf_git_path_submodule() to files-backend.c
 - kill register_ref_store() and lookup_ref_store(). Their main code
   for submdules is still there, under the names
   {register,lookup}_submodule_ref_store(). There's no mixing up
   main and submodule stores anymore.

I think the end result looks pretty good. refs.c is now almost
submodule-free, if you don't count the submodule hashmap and the
wrapper API.

I'll be sending two more follow-up series, if you are interested, soon:

1) v2 of nd/worktree-gc-protection

which kills parse_ref() in worktree.c _and_ set_worktree_head_symref()
in files-backend.c. Both are bad things that should not have happened.
(PS. The topic name is misleading as this is mostly about eliminating
warts, unless Junio intended to combine my second series as well)

This series introduces get_worktree_ref_store() and adds two new APIs
refs_resolve_ref_unsafe() and refs_create_symref(). I'm still not sure
if the refs_ prefix is good naming, but I had to pick something to get
things going. Name suggestions are welcome.

2) the real worktree-gc-protection

This series adds a bunch of new refs API, enough for revision.c to
traverses all sorts of refs with a ref store instead of "submodule".
Many _submodule API are removed as a result because they no longer
have any callers (yay!). One of them remains though.

I'm also playing a bit on the side with the "linked worktree" ref
store, in order to get rid of worktree-specific logic from
files-backend. After that lmdb patches can use some cleanup and
finally enter. But this is kinda low priority for me.

Nguyễn Thái Ngọc Duy (16):
  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: introduce get_main_ref_store()
  refs: rename lookup_ref_store() to lookup_submodule_ref_store()
  refs.c: flatten get_ref_store() a bit
  refs.c: kill register_ref_store(), add register_submodule_ref_store()
  refs.c: make get_main_ref_store() public and use it
  path.c: move some code out of strbuf_git_path_submodule()
  refs: move submodule code out of files-backend.c
  files-backend: remove submodule_allowed from files_downcast()
  refs: rename get_ref_store() to get_submodule_ref_store() and make it
    public

 path.c               |  34 ++---
 refs.c               | 144 +++++++++++----------
 refs.h               |  13 ++
 refs/files-backend.c | 347 ++++++++++++++++++++++++++++++---------------------
 refs/refs-internal.h |  28 ++---
 submodule.c          |  31 +++++
 submodule.h          |   1 +
 7 files changed, 346 insertions(+), 252 deletions(-)

-- 
2.11.0.157.gd943d85