]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2013-checkout-submodule.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t2013-checkout-submodule.sh
CommitLineData
bef38948
JS
1#!/bin/sh
2
3test_description='checkout can handle submodules'
4
5. ./test-lib.sh
d78ecca5 6. "$TEST_DIRECTORY"/lib-submodule-update.sh
bef38948
JS
7
8test_expect_success 'setup' '
9 mkdir submodule &&
10 (cd submodule &&
11 git init &&
12 test_commit first) &&
13 git add submodule &&
14 test_tick &&
15 git commit -m superproject &&
16 (cd submodule &&
17 test_commit second) &&
18 git add submodule &&
19 test_tick &&
20 git commit -m updated.superproject
21'
22
23test_expect_success '"reset <submodule>" updates the index' '
24 git update-index --refresh &&
25 git diff-files --quiet &&
26 git diff-index --quiet --cached HEAD &&
d94c5e2f 27 git reset HEAD^ submodule &&
bef38948
JS
28 test_must_fail git diff-files --quiet &&
29 git reset submodule &&
30 git diff-files --quiet
31'
32
33test_expect_success '"checkout <submodule>" updates the index only' '
34 git update-index --refresh &&
35 git diff-files --quiet &&
36 git diff-index --quiet --cached HEAD &&
37 git checkout HEAD^ submodule &&
38 test_must_fail git diff-files --quiet &&
39 git checkout HEAD submodule &&
40 git diff-files --quiet
41'
42
62ed0096
JL
43test_expect_success '"checkout <submodule>" honors diff.ignoreSubmodules' '
44 git config diff.ignoreSubmodules dirty &&
45 echo x> submodule/untracked &&
46 git checkout HEAD >actual 2>&1 &&
ec10b018 47 test_must_be_empty actual
62ed0096
JL
48'
49
23b4c7bc
JL
50test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .gitmodules' '
51 git config diff.ignoreSubmodules none &&
52 git config -f .gitmodules submodule.submodule.path submodule &&
53 git config -f .gitmodules submodule.submodule.ignore untracked &&
54 git checkout HEAD >actual 2>&1 &&
ec10b018 55 test_must_be_empty actual
23b4c7bc
JL
56'
57
58test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/config' '
59 git config -f .gitmodules submodule.submodule.ignore none &&
60 git config submodule.submodule.path submodule &&
61 git config submodule.submodule.ignore all &&
62 git checkout HEAD >actual 2>&1 &&
ec10b018 63 test_must_be_empty actual
23b4c7bc
JL
64'
65
1fc458d9 66KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
17f38cb7 67test_submodule_switch_recursing_with_args "checkout"
1fc458d9 68
17f38cb7 69test_submodule_forced_switch_recursing_with_args "checkout -f"
1fc458d9 70
d78ecca5
JL
71test_submodule_switch "git checkout"
72
73test_submodule_forced_switch "git checkout -f"
74
bef38948 75test_done