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
16 TEST_PASSES_SANITIZE_LEAK
=true
19 test_expect_success
'setup' '
20 git config --global protocol.file.allow always
23 test_expect_success
'submodule on detached working tree' '
24 git init --bare remote &&
25 test_create_repo bundle1 &&
28 test_commit "shoot" &&
29 git rev-parse --verify HEAD >../expect
34 GIT_WORK_TREE="$(pwd)" &&
35 GIT_DIR="$(pwd)/.dotfiles" &&
36 export GIT_WORK_TREE GIT_DIR &&
37 git clone --bare ../remote .dotfiles &&
38 git submodule add ../bundle1 .vim/bundle/sogood &&
39 test_commit "sogood" &&
41 unset GIT_WORK_TREE GIT_DIR &&
42 cd .vim/bundle/sogood &&
43 git rev-parse --verify HEAD >actual &&
44 test_cmp ../../../../expect actual
51 git clone --bare ../remote .dotfiles &&
52 GIT_WORK_TREE="$(pwd)" &&
53 GIT_DIR="$(pwd)/.dotfiles" &&
54 export GIT_WORK_TREE GIT_DIR &&
56 git submodule update --init &&
58 unset GIT_WORK_TREE GIT_DIR &&
59 cd .vim/bundle/sogood &&
60 git rev-parse --verify HEAD >actual &&
61 test_cmp ../../../../expect actual
66 test_expect_success
'submodule on detached working pointed by core.worktree' '
70 GIT_DIR="$(pwd)/.dotfiles" &&
72 git clone --bare ../remote "$GIT_DIR" &&
73 git config core.bare false &&
74 git config core.worktree .. &&
76 git submodule add ../bundle1 .vim/bundle/dupe &&
82 GIT_DIR="$(pwd)/.dotfiles" &&
84 git config core.bare false &&
85 git config core.worktree .. &&
87 git submodule update --init &&
88 test -f .vim/bundle/dupe/shoot.t