3 test_description='merging when a directory was replaced with a symlink'
6 test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' '
7 mkdir -p a/b/c a/b-2/c &&
17 git commit -m "dir to symlink"
20 test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
21 git checkout HEAD^0 &&
22 git reset --hard master &&
23 git rm --cached a/b &&
24 git commit -m "untracked symlink remains" &&
25 git checkout start^0 &&
29 test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '
30 git checkout HEAD^0 &&
31 git reset --hard master &&
32 git checkout start^0 &&
36 test_expect_success SYMLINKS 'setup for merge test' '
45 test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
47 git checkout baseline^0 &&
48 git merge -s resolve master &&
53 test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
55 git checkout baseline^0 &&
56 git merge -s recursive master &&
61 test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
63 git checkout master^0 &&
64 git merge -s resolve baseline^0 &&
69 test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
71 git checkout master^0 &&
72 git merge -s recursive baseline^0 &&
77 test_expect_failure SYMLINKS 'do not lose untracked in merge (resolve)' '
79 git checkout baseline^0 &&
81 test_must_fail git merge -s resolve master &&
86 test_expect_success SYMLINKS 'do not lose untracked in merge (recursive)' '
88 git checkout baseline^0 &&
90 test_must_fail git merge -s recursive master &&
95 test_expect_success SYMLINKS 'do not lose modifications in merge (resolve)' '
97 git checkout baseline^0 &&
98 echo more content >>a/b/c/d &&
99 test_must_fail git merge -s resolve master
102 test_expect_success SYMLINKS 'do not lose modifications in merge (recursive)' '
104 git checkout baseline^0 &&
105 echo more content >>a/b/c/d &&
106 test_must_fail git merge -s recursive master
109 test_expect_success SYMLINKS 'setup a merge where dir a/b-2 changed to symlink' '
111 git checkout start^0 &&
115 git commit -m "dir a/b-2 to symlink" &&
119 test_expect_success SYMLINKS 'merge should not have D/F conflicts (resolve)' '
121 git checkout baseline^0 &&
122 git merge -s resolve test2 &&
127 test_expect_success SYMLINKS 'merge should not have D/F conflicts (recursive)' '
129 git checkout baseline^0 &&
130 git merge -s recursive test2 &&
135 test_expect_success SYMLINKS 'merge should not have F/D conflicts (recursive)' '
137 git checkout -b foo test2 &&
138 git merge -s recursive baseline^0 &&