t7409: make sure submodule is initialized and updated in more detail

The earlier test did not even make sure that the correct commit is checked out in the submodule directory. Inspect the result in a bit more detail. Signed-off-by: Daniel Graña <dangra@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Graña committed Jul 30, 2012 at 14:51 UTC 95e7705310bce3b2721ebf789776c170cf424abb
1 file changed +23 -6
t/t7409-submodule-detached-worktree.sh
+23 -6
@@ -15,7 +15,11 @@ TEST_NO_CREATE_REPO=1
15 test_expect_success 'submodule on detached working tree' '
16 git init --bare remote &&
17 test_create_repo bundle1 &&
18 - (cd bundle1 && test_commit "shoot") &&
18 + (
19 + cd bundle1 &&
20 + test_commit "shoot" &&
21 + git rev-parse --verify HEAD >../expect
22 + ) &&
23 mkdir home &&
24 (
25 cd home &&
@@ -23,14 +27,27 @@ test_expect_success 'submodule on detached working tree' '
27 git clone --bare ../remote .dotfiles &&
28 git submodule add ../bundle1 .vim/bundle/sogood &&
29 test_commit "sogood" &&
30 + (
31 + unset GIT_WORK_TREE GIT_DIR &&
32 + cd .vim/bundle/sogood &&
33 + git rev-parse --verify HEAD >actual &&
34 + test_cmp ../../../../expect actual
35 + ) &&
36 git push origin master
37 ) &&
38 mkdir home2 &&
39 (
40 cd home2 &&
31 - export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
41 git clone --bare ../remote .dotfiles &&
33 - git submodule update --init
42 + export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
43 + git checkout master &&
44 + git submodule update --init &&
45 + (
46 + unset GIT_WORK_TREE GIT_DIR &&
47 + cd .vim/bundle/sogood &&
48 + git rev-parse --verify HEAD >actual &&
49 + test_cmp ../../../../expect actual
50 + )
51 )
52 '
53
@@ -42,6 +59,7 @@ test_expect_success 'submodule on detached working pointed by core.worktree' '
59 git clone --bare ../remote "$GIT_DIR" &&
60 git config core.bare false &&
61 git config core.worktree .. &&
62 + git checkout master &&
63 git submodule add ../bundle1 .vim/bundle/dupe &&
64 test_commit "dupe" &&
65 git push origin master
@@ -52,9 +70,8 @@ test_expect_success 'submodule on detached working pointed by core.worktree' '
70 git config core.bare false &&
71 git config core.worktree .. &&
72 git pull &&
55 - git submodule update &&
56 - git submodule status &&
57 - test -d .vim/bundle/dupe
73 + git submodule update --init &&
74 + test -f .vim/bundle/dupe/shoot.t
75 )
76 '
77