• S
    submodule absorbing: fix worktree/gitdir pointers recursively for non-moves · ec9629b3
    Stefan Beller 提交于
    Consider having a submodule 'sub' and a nested submodule at 'sub/nested'.
    When nested is already absorbed into sub, but sub is not absorbed into
    its superproject, then we need to fixup the gitfile and core.worktree
    setting for 'nested' when absorbing 'sub', but we do not need to move
    its git dir around.
    
    Previously 'nested's gitfile contained "gitdir: ../.git/modules/nested";
    it has to be corrected to "gitdir: ../../.git/modules/sub1/modules/nested".
    
    An alternative I considered to do this work lazily, i.e. when resolving
    "../.git/modules/nested", we would notice the ".git" being a gitfile
    linking to another path.  That seemed to be robuster by design, but harder
    to get the implementation right.  Maybe we have to do that anyway once we
    try to have submodules and worktrees working nicely together, but for now
    just produce 'correct' (i.e. direct) pointers.
    Signed-off-by: NStefan Beller <sbeller@google.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    ec9629b3
submodule.c 41.3 KB