Merge branch 'mh/maint-config-doc-proxy-command'
[git/mingw.git] / t / t7409-submodule-detached-worktree.sh
blob2fec13dcd32a551d4fb82d0bea185ba6b77c9e14
1 #!/bin/sh
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
12 TEST_NO_CREATE_REPO=1
13 . ./test-lib.sh
15 test_expect_success 'submodule on detached working tree' '
16 git init --bare remote &&
17 test_create_repo bundle1 &&
19 cd bundle1 &&
20 test_commit "shoot" &&
21 git rev-parse --verify HEAD >../expect
22 ) &&
23 mkdir home &&
25 cd home &&
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
35 ) &&
36 git push origin master
37 ) &&
38 mkdir home2 &&
40 cd home2 &&
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' '
55 mkdir home3 &&
57 cd home3 &&
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 &&
64 test_commit "dupe" &&
65 git push origin master
66 ) &&
68 cd home &&
69 export GIT_DIR="$(pwd)/.dotfiles" &&
70 git config core.bare false &&
71 git config core.worktree .. &&
72 git pull &&
73 git submodule update --init &&
74 test -f .vim/bundle/dupe/shoot.t
78 test_done