3 test_description
='checkout can handle submodules'
7 test_expect_success
'setup' '
14 git commit -m superproject &&
16 test_commit second) &&
19 git commit -m updated.superproject
22 test_expect_success
'"reset <submodule>" updates the index' '
23 git update-index --refresh &&
24 git diff-files --quiet &&
25 git diff-index --quiet --cached HEAD &&
26 test_must_fail git reset HEAD^ submodule &&
27 test_must_fail git diff-files --quiet &&
28 git reset submodule &&
29 git diff-files --quiet
32 test_expect_success
'"checkout <submodule>" updates the index only' '
33 git update-index --refresh &&
34 git diff-files --quiet &&
35 git diff-index --quiet --cached HEAD &&
36 git checkout HEAD^ submodule &&
37 test_must_fail git diff-files --quiet &&
38 git checkout HEAD submodule &&
39 git diff-files --quiet
42 test_expect_success
'"checkout <submodule>" honors diff.ignoreSubmodules' '
43 git config diff.ignoreSubmodules dirty &&
44 echo x> submodule/untracked &&
45 git checkout HEAD >actual 2>&1 &&
49 test_expect_success
'"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
50 git config diff.ignoreSubmodules none &&
51 git config -f .gitmodules submodule.submodule.path submodule &&
52 git config -f .gitmodules submodule.submodule.ignore untracked &&
53 git checkout HEAD >actual 2>&1 &&
57 test_expect_success
'"checkout <submodule>" honors submodule.*.ignore from .git/config' '
58 git config -f .gitmodules submodule.submodule.ignore none &&
59 git config submodule.submodule.path submodule &&
60 git config submodule.submodule.ignore all &&
61 git checkout HEAD >actual 2>&1 &&