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 'submodule on detached working tree' '
19 git init --bare remote &&
20 test_create_repo bundle1 &&
23 test_commit "shoot" &&
24 git rev-parse --verify HEAD >../expect
29 GIT_WORK_TREE="$(pwd)" &&
30 GIT_DIR="$(pwd)/.dotfiles" &&
31 export GIT_WORK_TREE GIT_DIR &&
32 git clone --bare ../remote .dotfiles &&
33 git submodule add ../bundle1 .vim/bundle/sogood &&
34 test_commit "sogood" &&
36 unset GIT_WORK_TREE GIT_DIR &&
37 cd .vim/bundle/sogood &&
38 git rev-parse --verify HEAD >actual &&
39 test_cmp ../../../../expect actual
46 git clone --bare ../remote .dotfiles &&
47 GIT_WORK_TREE="$(pwd)" &&
48 GIT_DIR="$(pwd)/.dotfiles" &&
49 export GIT_WORK_TREE GIT_DIR &&
51 git submodule update --init &&
53 unset GIT_WORK_TREE GIT_DIR &&
54 cd .vim/bundle/sogood &&
55 git rev-parse --verify HEAD >actual &&
56 test_cmp ../../../../expect actual
61 test_expect_success 'submodule on detached working pointed by core.worktree' '
65 GIT_DIR="$(pwd)/.dotfiles" &&
67 git clone --bare ../remote "$GIT_DIR" &&
68 git config core.bare false &&
69 git config core.worktree .. &&
71 git submodule add ../bundle1 .vim/bundle/dupe &&
77 GIT_DIR="$(pwd)/.dotfiles" &&
79 git config core.bare false &&
80 git config core.worktree .. &&
82 git submodule update --init &&
83 test -f .vim/bundle/dupe/shoot.t