git stash: make sure that .git/logs/refs/ exists
[git/mingw/4msysgit.git] / t / t7409-submodule-detached-worktree.sh
blobc20717181e95fc74738bdf53aa3e0b0797d77d6a
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 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
37 ) &&
38 git push origin master
39 ) &&
40 mkdir home2 &&
42 cd home2 &&
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' '
59 mkdir home3 &&
61 cd home3 &&
62 GIT_DIR="$(pwd)/.dotfiles" &&
63 export GIT_DIR &&
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 &&
69 test_commit "dupe" &&
70 git push origin master
71 ) &&
73 cd home &&
74 GIT_DIR="$(pwd)/.dotfiles" &&
75 export GIT_DIR &&
76 git config core.bare false &&
77 git config core.worktree .. &&
78 git pull &&
79 git submodule update --init &&
80 test -f .vim/bundle/dupe/shoot.t
84 test_done