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 detached working trees
13 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
14 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
18 test_expect_success
'setup' '
19 git config --global protocol.file.allow always
22 test_expect_success
'submodule on detached working tree' '
23 git init --bare remote &&
24 test_create_repo bundle1 &&
27 test_commit "shoot" &&
28 git rev-parse --verify HEAD >../expect
33 GIT_WORK_TREE="$(pwd)" &&
34 GIT_DIR="$(pwd)/.dotfiles" &&
35 export GIT_WORK_TREE GIT_DIR &&
36 git clone --bare ../remote .dotfiles &&
37 git submodule add ../bundle1 .vim/bundle/sogood &&
38 test_commit "sogood" &&
40 unset GIT_WORK_TREE GIT_DIR &&
41 cd .vim/bundle/sogood &&
42 git rev-parse --verify HEAD >actual &&
43 test_cmp ../../../../expect actual
50 git clone --bare ../remote .dotfiles &&
51 GIT_WORK_TREE="$(pwd)" &&
52 GIT_DIR="$(pwd)/.dotfiles" &&
53 export GIT_WORK_TREE GIT_DIR &&
55 git submodule update --init &&
57 unset GIT_WORK_TREE GIT_DIR &&
58 cd .vim/bundle/sogood &&
59 git rev-parse --verify HEAD >actual &&
60 test_cmp ../../../../expect actual
65 test_expect_success
'submodule on detached working pointed by core.worktree' '
69 GIT_DIR="$(pwd)/.dotfiles" &&
71 git clone --bare ../remote "$GIT_DIR" &&
72 git config core.bare false &&
73 git config core.worktree .. &&
75 git submodule add ../bundle1 .vim/bundle/dupe &&
81 GIT_DIR="$(pwd)/.dotfiles" &&
83 git config core.bare false &&
84 git config core.worktree .. &&
86 git submodule update --init &&
87 test -f .vim/bundle/dupe/shoot.t