git-bundle.txt: add missing words and punctuation
[git/debian.git] / t / t7409-submodule-detached-work-tree.sh
blobe17ac81a893e329828c5bfe1458f4db1a2fb4841
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 detached working trees
12 TEST_NO_CREATE_REPO=1
13 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
14 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
16 . ./test-lib.sh
18 test_expect_success 'submodule on detached working tree' '
19 git init --bare remote &&
20 test_create_repo bundle1 &&
22 cd bundle1 &&
23 test_commit "shoot" &&
24 git rev-parse --verify HEAD >../expect
25 ) &&
26 mkdir home &&
28 cd home &&
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
40 ) &&
41 git push origin main
42 ) &&
43 mkdir home2 &&
45 cd home2 &&
46 git clone --bare ../remote .dotfiles &&
47 GIT_WORK_TREE="$(pwd)" &&
48 GIT_DIR="$(pwd)/.dotfiles" &&
49 export GIT_WORK_TREE GIT_DIR &&
50 git checkout main &&
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' '
62 mkdir home3 &&
64 cd home3 &&
65 GIT_DIR="$(pwd)/.dotfiles" &&
66 export GIT_DIR &&
67 git clone --bare ../remote "$GIT_DIR" &&
68 git config core.bare false &&
69 git config core.worktree .. &&
70 git checkout main &&
71 git submodule add ../bundle1 .vim/bundle/dupe &&
72 test_commit "dupe" &&
73 git push origin main
74 ) &&
76 cd home &&
77 GIT_DIR="$(pwd)/.dotfiles" &&
78 export GIT_DIR &&
79 git config core.bare false &&
80 git config core.worktree .. &&
81 git pull &&
82 git submodule update --init &&
83 test -f .vim/bundle/dupe/shoot.t
87 test_done