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' '
38 test_must_fail git merge branch 2>out &&
43 error
: Your
local changes to the following files would be overwritten by merge
:
47 Please
, commit your changes or stash them before you can merge.
48 error
: The following untracked working tree files would be overwritten by merge
:
50 Please move or remove them before you can merge.
53 test_expect_success
'untracked files or local changes ovewritten by merge' '
57 test_must_fail git merge branch 2>out &&
62 error
: Your
local changes to the following files would be overwritten by checkout
:
65 Please
, commit your changes or stash them before you can switch branches.
68 test_expect_success
'cannot switch branches because of local changes' '
73 git add rep/one rep/two &&
74 git commit -m Fourth &&
75 git checkout master &&
78 test_must_fail git checkout branch 2>out &&
83 error
: Your
local changes to the following files would be overwritten by checkout
:
86 Please
, commit your changes or stash them before you can switch branches.
89 test_expect_success
'not uptodate file porcelain checkout error' '
90 git add rep/one rep/two &&
91 test_must_fail git checkout branch 2>out &&
96 error
: Updating the following directories would lose untracked files
in it
:
102 test_expect_success
'not_uptodate_dir porcelain checkout error' '
109 git add rep/foo rep2/foo &&
110 git commit -m init &&
111 git checkout -b branch &&
117 git commit -m "added test as a file" &&
118 git checkout master &&
119 >rep/untracked-file &&
120 >rep2/untracked-file &&
121 test_must_fail git checkout branch 2>out &&
122 test_cmp out ../expect