3 test_description
='checkout must not overwrite an untracked objects'
6 test_expect_success
'setup' '
15 test_expect_success
'create a commit where dir a/b changed to file' '
17 git checkout -b file &&
21 git commit -m "dir to file"
24 test_expect_success
'checkout commit with dir must not remove untracked a/b' '
26 git rm --cached a/b &&
27 git commit -m "un-track the file" &&
28 test_must_fail git checkout start &&
32 test_expect_success
'create a commit where dir a/b changed to symlink' '
34 rm -rf a/b && # cleanup if previous test failed
35 git checkout -f -b symlink start &&
38 test_ln_s_add foo a/b &&
39 git commit -m "dir to symlink"
42 test_expect_success
'checkout commit with dir must not remove untracked a/b' '
44 git rm --cached a/b &&
45 git commit -m "un-track the symlink" &&
46 test_must_fail git checkout start
49 test_expect_success SYMLINKS
'the symlink remained' '
54 test_expect_success SYMLINKS
'checkout -f must not follow symlinks when removing entries' '
55 git checkout -f start &&
59 git commit -m "add dir/f" &&
61 ln -s untracked dir &&
62 git checkout -f HEAD~ &&
63 test_path_is_file untracked/f