3 test_description='merging when a directory was replaced with a symlink'
6 test_expect_success 'create a commit where dir a/b changed to symlink' '
7 mkdir -p a/b/c a/b-2/c &&
16 test_ln_s_add b-2 a/b &&
17 git commit -m "dir to symlink"
20 test_expect_success 'checkout does not clobber untracked symlink' '
21 git checkout HEAD^0 &&
22 git reset --hard master &&
23 git rm --cached a/b &&
24 git commit -m "untracked symlink remains" &&
25 test_must_fail git checkout start^0
28 test_expect_success 'a/b-2/c/d is kept when clobbering symlink b' '
29 git checkout HEAD^0 &&
30 git reset --hard master &&
31 git rm --cached a/b &&
32 git commit -m "untracked symlink remains" &&
33 git checkout -f start^0 &&
37 test_expect_success 'checkout should not have deleted a/b-2/c/d' '
38 git checkout HEAD^0 &&
39 git reset --hard master &&
40 git checkout start^0 &&
44 test_expect_success 'setup for merge test' '
53 test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
55 git checkout baseline^0 &&
56 git merge -s resolve master &&
60 test_expect_success SYMLINKS 'a/b was resolved as symlink' '
64 test_expect_success 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
66 git checkout baseline^0 &&
67 git merge -s recursive master &&
71 test_expect_success SYMLINKS 'a/b was resolved as symlink' '
75 test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
77 git checkout master^0 &&
78 git merge -s resolve baseline^0 &&
82 test_expect_success SYMLINKS 'a/b was resolved as symlink' '
86 test_expect_success 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
88 git checkout master^0 &&
89 git merge -s recursive baseline^0 &&
93 test_expect_success SYMLINKS 'a/b was resolved as symlink' '
97 test_expect_failure 'do not lose untracked in merge (resolve)' '
99 git checkout baseline^0 &&
101 test_must_fail git merge -s resolve master &&
106 test_expect_success 'do not lose untracked in merge (recursive)' '
108 git checkout baseline^0 &&
110 test_must_fail git merge -s recursive master &&
115 test_expect_success 'do not lose modifications in merge (resolve)' '
117 git checkout baseline^0 &&
118 echo more content >>a/b/c/d &&
119 test_must_fail git merge -s resolve master
122 test_expect_success 'do not lose modifications in merge (recursive)' '
124 git checkout baseline^0 &&
125 echo more content >>a/b/c/d &&
126 test_must_fail git merge -s recursive master
129 test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
131 git checkout start^0 &&
134 test_ln_s_add b a/b-2 &&
135 git commit -m "dir a/b-2 to symlink" &&
139 test_expect_success 'merge should not have D/F conflicts (resolve)' '
141 git checkout baseline^0 &&
142 git merge -s resolve test2 &&
146 test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '
150 test_expect_success 'merge should not have D/F conflicts (recursive)' '
152 git checkout baseline^0 &&
153 git merge -s recursive test2 &&
157 test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '
161 test_expect_success 'merge should not have F/D conflicts (recursive)' '
163 git checkout -b foo test2 &&
164 git merge -s recursive baseline^0 &&
168 test_expect_success SYMLINKS 'a/b-2 was resolved as symlink' '