Add tests for directory/submodule and file/submodule conflicts
[git/dscho.git] / t / t7404-submodule-tree.sh
blob7c7afd90f5f51abad33a045ab37d4fbdbfe554fc
1 #!/bin/sh
3 # Copyright (c) 2008 Johannes E. Schindelin
6 test_description='git submodule/tree conflict
8 Tests what happens when a subdirectory becomes a submodule all of a sudden.
11 . ./test-lib.sh
13 test_expect_success setup '
15 mkdir sub &&
16 echo original > sub/file &&
17 git add sub/file &&
18 test_tick &&
19 git commit -m initial &&
20 echo newer > sub/file &&
21 test_tick &&
22 git commit -m newer sub/file &&
23 git checkout -b side HEAD^ &&
24 git rm sub/file &&
25 mkdir sub &&
26 (cd sub &&
27 git init &&
28 echo file > file &&
29 git add file &&
30 test_tick &&
31 git commit -m submodule) &&
32 git add sub &&
33 test_tick &&
34 git commit -m with-submodule
38 test_expect_failure 'merging with tree/submodule conflict fails' '
40 test_must_fail git merge master &&
41 test -f .git/MERGE_MSG
45 test_expect_failure 'the other way round' '
47 git reset --hard &&
48 mv sub submodule &&
49 git checkout -f master &&
50 test_must_fail git merge side &&
51 test -f .git/MERGE_MSG
55 # This will be only a failure when the previous tests succeed
56 test_expect_failure 'checkout from submodule/directory conflict' '
58 git checkout -f -b side2 HEAD^ &&
59 test -z "$(git ls-files --unmerged)"
63 test_expect_failure 'merge submodule without changing the directory' '
65 git reset --hard &&
66 echo another > file &&
67 git add file &&
68 test_tick &&
69 git commit -m side2 &&
70 test_must_fail git merge side &&
71 test -f .git/MERGE_MSG
75 test_expect_failure 'file/submodule conflict' '
77 git reset --hard &&
78 git rm file &&
79 git mv sub file &&
80 test_tick &&
81 git commit -m side2 &&
82 git checkout -b side3 HEAD^ &&
83 echo yet another > file2 &&
84 git add file2 &&
85 test_tick &&
86 git commit -m side3 &&
87 git merge side2
91 test_done