3 # Copyright (c) 2012 Daniel GraƱa
6 test_description
='Test submodules on detached working tree
8 This test verifies that "git submodule" initialization, update and addition works
9 on detahced working trees
15 test_expect_success
'submodule on detached working tree' '
16 git init --bare remote &&
17 test_create_repo bundle1 &&
20 test_commit "shoot" &&
21 git rev-parse --verify HEAD >../expect
26 export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
27 git clone --bare ../remote .dotfiles &&
28 git submodule add ../bundle1 .vim/bundle/sogood &&
29 test_commit "sogood" &&
31 unset GIT_WORK_TREE GIT_DIR &&
32 cd .vim/bundle/sogood &&
33 git rev-parse --verify HEAD >actual &&
34 test_cmp ../../../../expect actual
36 git push origin master
41 git clone --bare ../remote .dotfiles &&
42 export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
43 git checkout master &&
44 git submodule update --init &&
46 unset GIT_WORK_TREE GIT_DIR &&
47 cd .vim/bundle/sogood &&
48 git rev-parse --verify HEAD >actual &&
49 test_cmp ../../../../expect actual
54 test_expect_success
'submodule on detached working pointed by core.worktree' '
58 export GIT_DIR="$(pwd)/.dotfiles" &&
59 git clone --bare ../remote "$GIT_DIR" &&
60 git config core.bare false &&
61 git config core.worktree .. &&
62 git checkout master &&
63 git submodule add ../bundle1 .vim/bundle/dupe &&
65 git push origin master
69 export GIT_DIR="$(pwd)/.dotfiles" &&
70 git config core.bare false &&
71 git config core.worktree .. &&
73 git submodule update --init &&
74 test -f .vim/bundle/dupe/shoot.t