This is what I imagine multi worktree support (aka git-new-workdir)
looks like. Basically two variables will control access to the repo:
$GIT_SUPER_DIR for worktree specific stuff and $GIT_DIR for the rest.
I like the idea of using git_path() to hide path relocation caused by
GIT_SUPER_DIR, but I may have made some design mistakes here..
setup_git_directory() changes are hairy. It's not surprise if I broke
something in there. Not important for a PoC though.
Final series may be a few patches longer as I only lay the foundation
in this series.
Nguyễn Thái Ngọc Duy (7):
Make git_path() beware of file relocation in $GIT_DIR
Add new environment variable $GIT_SUPER_DIR
setup.c: add split-repo support to .git files
setup.c: add split-repo support to is_git_directory()
setup.c: reduce cleanup sites in setup_explicit_git_dir()
setup.c: add split-repo support to setup_git_directory*
init: add --split-repo with the same functionality as git-new-workdir
builtin/init-db.c | 42 +++++++++++++++
cache.h | 5 ++
environment.c | 37 ++++++++++++--
path.c | 45 ++++++++++++++--
setup.c | 139 ++++++++++++++++++++++++++++++++++----------------
t/t0060-path-utils.sh | 115 +++++++++++++++++++++++++++++++++++++++++
test-path-utils.c | 7 +++
trace.c | 1 +
8 files changed, 339 insertions(+), 52 deletions(-)
--
1.8.5.1.77.g42c48fa