diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-03 11:25:18 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-03 11:25:18 -0800 |
commit | 5348021c6750bc22778705a454e4c6ad85414245 (patch) | |
tree | df54cc57a01525617534d1d7717a53a939e80490 /t | |
parent | Merge branch 'sb/unpack-trees-super-prefix' (diff) | |
parent | submodule absorbing: fix worktree/gitdir pointers recursively for non-moves (diff) | |
download | tgif-5348021c6750bc22778705a454e4c6ad85414245.tar.xz |
Merge branch 'sb/submodule-recursive-absorb'
When a submodule "A", which has another submodule "B" nested within
it, is "absorbed" into the top-level superproject, the inner
submodule "B" used to be left in a strange state. The logic to
adjust the .git pointers in these submodules has been corrected.
* sb/submodule-recursive-absorb:
submodule absorbing: fix worktree/gitdir pointers recursively for non-moves
cache.h: expose the dying procedure for reading gitlinks
setup: add gentle version of resolve_git_dir
Diffstat (limited to 't')
-rwxr-xr-x | t/t7412-submodule-absorbgitdirs.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh index 1c47780e2b..e2bbb449b6 100755 --- a/t/t7412-submodule-absorbgitdirs.sh +++ b/t/t7412-submodule-absorbgitdirs.sh @@ -64,6 +64,33 @@ test_expect_success 'absorb the git dir in a nested submodule' ' test_cmp expect.2 actual.2 ' +test_expect_success 're-setup nested submodule' ' + # un-absorb the direct submodule, to test if the nested submodule + # is still correct (needs a rewrite of the gitfile only) + rm -rf sub1/.git && + mv .git/modules/sub1 sub1/.git && + GIT_WORK_TREE=. git -C sub1 config --unset core.worktree && + # fixup the nested submodule + echo "gitdir: ../.git/modules/nested" >sub1/nested/.git && + GIT_WORK_TREE=../../../nested git -C sub1/.git/modules/nested config \ + core.worktree "../../../nested" && + # make sure this re-setup is correct + git status --ignore-submodules=none +' + +test_expect_success 'absorb the git dir in a nested submodule' ' + git status >expect.1 && + git -C sub1/nested rev-parse HEAD >expect.2 && + git submodule absorbgitdirs && + test -f sub1/.git && + test -f sub1/nested/.git && + test -d .git/modules/sub1/modules/nested && + git status >actual.1 && + git -C sub1/nested rev-parse HEAD >actual.2 && + test_cmp expect.1 actual.1 && + test_cmp expect.2 actual.2 +' + test_expect_success 'setup a gitlink with missing .gitmodules entry' ' git init sub2 && test_commit -C sub2 first && |