t/: correct obvious typo "detahced"
[git/git.git] / t / t7409-submodule-detached-work-tree.sh
CommitLineData
be8779f7
DG
1#!/bin/sh
2#
3# Copyright (c) 2012 Daniel Graña
4#
5
6test_description='Test submodules on detached working tree
7
8This test verifies that "git submodule" initialization, update and addition works
c9a800a6 9on detached working trees
be8779f7
DG
10'
11
12TEST_NO_CREATE_REPO=1
13. ./test-lib.sh
14
15test_expect_success 'submodule on detached working tree' '
16 git init --bare remote &&
17 test_create_repo bundle1 &&
95e77053
DG
18 (
19 cd bundle1 &&
20 test_commit "shoot" &&
21 git rev-parse --verify HEAD >../expect
22 ) &&
be8779f7
DG
23 mkdir home &&
24 (
25 cd home &&
a8addfec
TB
26 GIT_WORK_TREE="$(pwd)" &&
27 GIT_DIR="$(pwd)/.dotfiles" &&
28 export GIT_WORK_TREE GIT_DIR &&
be8779f7
DG
29 git clone --bare ../remote .dotfiles &&
30 git submodule add ../bundle1 .vim/bundle/sogood &&
31 test_commit "sogood" &&
95e77053
DG
32 (
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 ) &&
be8779f7
DG
38 git push origin master
39 ) &&
40 mkdir home2 &&
41 (
42 cd home2 &&
be8779f7 43 git clone --bare ../remote .dotfiles &&
a8addfec
TB
44 GIT_WORK_TREE="$(pwd)" &&
45 GIT_DIR="$(pwd)/.dotfiles" &&
46 export GIT_WORK_TREE GIT_DIR &&
95e77053
DG
47 git checkout master &&
48 git submodule update --init &&
49 (
50 unset GIT_WORK_TREE GIT_DIR &&
51 cd .vim/bundle/sogood &&
52 git rev-parse --verify HEAD >actual &&
53 test_cmp ../../../../expect actual
54 )
be8779f7
DG
55 )
56'
57
58test_expect_success 'submodule on detached working pointed by core.worktree' '
59 mkdir home3 &&
60 (
61 cd home3 &&
a8addfec
TB
62 GIT_DIR="$(pwd)/.dotfiles" &&
63 export GIT_DIR &&
be8779f7
DG
64 git clone --bare ../remote "$GIT_DIR" &&
65 git config core.bare false &&
66 git config core.worktree .. &&
95e77053 67 git checkout master &&
be8779f7
DG
68 git submodule add ../bundle1 .vim/bundle/dupe &&
69 test_commit "dupe" &&
70 git push origin master
71 ) &&
72 (
73 cd home &&
a8addfec
TB
74 GIT_DIR="$(pwd)/.dotfiles" &&
75 export GIT_DIR &&
be8779f7
DG
76 git config core.bare false &&
77 git config core.worktree .. &&
78 git pull &&
95e77053
DG
79 git submodule update --init &&
80 test -f .vim/bundle/dupe/shoot.t
be8779f7
DG
81 )
82'
83
84test_done