3 test_description='unpack-trees error messages'
8 test_expect_success 'setup' '
11 git commit -a -m First &&
13 git checkout -b branch &&
18 git add two three four five &&
19 git commit -m Second &&
21 git checkout master &&
29 error: The following untracked working tree files would be overwritten by merge:
34 Please move or remove them before you can merge.
37 test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
38 test_must_fail git merge branch 2>out &&
39 test_cmp out expect &&
40 git commit --allow-empty -m empty &&
42 GIT_MERGE_VERBOSITY=0 &&
43 export GIT_MERGE_VERBOSITY &&
44 test_must_fail git merge branch 2>out2
46 test_cmp out2 expect &&
47 git reset --hard HEAD^
51 error: Your local changes to the following files would be overwritten by merge:
55 Please, commit your changes or stash them before you can merge.
56 error: The following untracked working tree files would be overwritten by merge:
58 Please move or remove them before you can merge.
61 test_expect_success 'untracked files or local changes ovewritten by merge' '
65 test_must_fail git merge branch 2>out &&
70 error: Your local changes to the following files would be overwritten by checkout:
73 Please, commit your changes or stash them before you can switch branches.
76 test_expect_success 'cannot switch branches because of local changes' '
81 git add rep/one rep/two &&
82 git commit -m Fourth &&
83 git checkout master &&
86 test_must_fail git checkout branch 2>out &&
91 error: Your local changes to the following files would be overwritten by checkout:
94 Please, commit your changes or stash them before you can switch branches.
97 test_expect_success 'not uptodate file porcelain checkout error' '
98 git add rep/one rep/two &&
99 test_must_fail git checkout branch 2>out &&
104 error: Updating the following directories would lose untracked files in it:
110 test_expect_success 'not_uptodate_dir porcelain checkout error' '
117 git add rep/foo rep2/foo &&
118 git commit -m init &&
119 git checkout -b branch &&
125 git commit -m "added test as a file" &&
126 git checkout master &&
127 >rep/untracked-file &&
128 >rep2/untracked-file &&
129 test_must_fail git checkout branch 2>out &&
130 test_cmp out ../expect