v5 goes a bit longer than v4, basically: - files_path() is broken down into three smaller functions, files_{packed_refs,reflog,refname}_path(). - most of store-based api is added because.. - test-ref-store.c is added with t1405 and t1406 for some basic tests I'm not aimimg for complete ref store coverage. But we can continue to improve from there. - refs_store_init() now takes a "permission" flag, like open(). Operations are allowed or forbidden based on this flag. The submodule_allowed flag is killed. files_assert_main.. remains. - get_*_ref_store() remain public api because it's used by test-ref-store.c and pack-refs.c. - files-backend.c should now make no function calls that implicitly target the main store. But this will have to be tested more to be sure. I'm tempted to add a tracing backend just for this purpose. Junio, if you take this on 'pu', you'll have to kick my other two series out (they should not even compile). I'm not resending them until I get a "looks mostly ok" from Michael. No point in updating them when this series keeps moving. This series is also available on my github repo. branch files-backend-git-dir-2. Nguyễn Thái Ngọc Duy (24): refs.h: add forward declaration for structs used in this file files-backend: make files_log_ref_write() static files-backend: add and use files_packed_refs_path() files-backend: convert git_path() to strbuf_git_path() files-backend: move "logs/" out of TMP_RENAMED_LOG files-backend: add and use files_reflog_path() files-backend: add and use files_refname_path() 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: replace submodule_allowed check in files_downcast() refs: rename get_ref_store() to get_submodule_ref_store() and make it public refs: add new ref-store api refs: new transaction related ref-store api files-backend: avoid ref api targetting main ref store refs: delete pack_refs() in favor of refs_pack_refs() t/helper: add test-ref-store to test ref-store functions t1405: some basic tests on main ref store t1406: new tests for submodule ref store Makefile | 1 + builtin/pack-refs.c | 2 +- path.c | 34 +-- refs.c | 411 ++++++++++++++++++-------- refs.h | 100 ++++++- refs/files-backend.c | 509 +++++++++++++++++++++----------- refs/refs-internal.h | 64 +--- submodule.c | 31 ++ submodule.h | 1 + t/helper/.gitignore | 1 + t/helper/test-ref-store.c (new) | 274 +++++++++++++++++ t/t1405-main-ref-store.sh (new +x) | 123 ++++++++ t/t1406-submodule-ref-store.sh (new +x) | 95 ++++++ 13 files changed, 1269 insertions(+), 377 deletions(-) create mode 100644 t/helper/test-ref-store.c create mode 100755 t/t1405-main-ref-store.sh create mode 100755 t/t1406-submodule-ref-store.sh -- 2.11.0.157.gd943d85