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 GIT_WORK_TREE="$(pwd)" &&
27 GIT_DIR="$(pwd)/.dotfiles" &&
28 export GIT_WORK_TREE GIT_DIR &&
29 git clone --bare ../remote .dotfiles &&
30 git submodule add ../bundle1 .vim/bundle/sogood &&
31 test_commit "sogood" &&
33 unset GIT_WORK_TREE GIT_DIR &&
34 cd .vim/bundle/sogood &&
35 git rev-parse --verify HEAD >actual &&
36 test_cmp ../../../../expect actual
38 git push origin master
43 git clone --bare ../remote .dotfiles &&
44 GIT_WORK_TREE="$(pwd)" &&
45 GIT_DIR="$(pwd)/.dotfiles" &&
46 export GIT_WORK_TREE GIT_DIR &&
47 git checkout master &&
48 git submodule update --init &&
50 unset GIT_WORK_TREE GIT_DIR &&
51 cd .vim/bundle/sogood &&
52 git rev-parse --verify HEAD >actual &&
53 test_cmp ../../../../expect actual
58 test_expect_success
'submodule on detached working pointed by core.worktree' '
62 GIT_DIR="$(pwd)/.dotfiles" &&
64 git clone --bare ../remote "$GIT_DIR" &&
65 git config core.bare false &&
66 git config core.worktree .. &&
67 git checkout master &&
68 git submodule add ../bundle1 .vim/bundle/dupe &&
70 git push origin master
74 GIT_DIR="$(pwd)/.dotfiles" &&
76 git config core.bare false &&
77 git config core.worktree .. &&
79 git submodule update --init &&
80 test -f .vim/bundle/dupe/shoot.t