Clarify and correct -z
[git/dscho.git] / t / t6035-merge-dir-to-symlink.sh
blob5b96fb0b37b8397342796fd3b9fec94c91063ba4
1 #!/bin/sh
3 test_description='merging when a directory was replaced with a symlink'
4 . ./test-lib.sh
6 if ! test_have_prereq SYMLINKS
7 then
8 say 'Symbolic links not supported, skipping tests.'
9 test_done
12 test_expect_success 'create a commit where dir a/b changed to symlink' '
13 mkdir -p a/b/c a/b-2/c &&
14 > a/b/c/d &&
15 > a/b-2/c/d &&
16 > a/x &&
17 git add -A &&
18 git commit -m base &&
19 git tag start &&
20 rm -rf a/b &&
21 ln -s b-2 a/b &&
22 git add -A &&
23 git commit -m "dir to symlink"
26 test_expect_success 'keep a/b-2/c/d across checkout' '
27 git checkout HEAD^0 &&
28 git reset --hard master &&
29 git rm --cached a/b &&
30 git commit -m "untracked symlink remains" &&
31 git checkout start^0 &&
32 test -f a/b-2/c/d
35 test_expect_success 'checkout should not have deleted a/b-2/c/d' '
36 git checkout HEAD^0 &&
37 git reset --hard master &&
38 git checkout start^0 &&
39 test -f a/b-2/c/d
42 test_expect_success 'setup for merge test' '
43 git reset --hard &&
44 test -f a/b-2/c/d &&
45 echo x > a/x &&
46 git add a/x &&
47 git commit -m x &&
48 git tag baseline
51 test_expect_success 'do not lose a/b-2/c/d in merge (resolve)' '
52 git reset --hard &&
53 git checkout baseline^0 &&
54 git merge -s resolve master &&
55 test -h a/b &&
56 test -f a/b-2/c/d
59 test_expect_failure 'do not lose a/b-2/c/d in merge (recursive)' '
60 git reset --hard &&
61 git checkout baseline^0 &&
62 git merge -s recursive master &&
63 test -h a/b &&
64 test -f a/b-2/c/d
67 test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
68 git reset --hard &&
69 git checkout start^0 &&
70 rm -rf a/b-2 &&
71 ln -s b a/b-2 &&
72 git add -A &&
73 git commit -m "dir a/b-2 to symlink" &&
74 git tag test2
77 test_expect_failure 'merge should not have conflicts (resolve)' '
78 git reset --hard &&
79 git checkout baseline^0 &&
80 git merge -s resolve test2 &&
81 test -h a/b-2 &&
82 test -f a/b/c/d
85 test_expect_failure 'merge should not have conflicts (recursive)' '
86 git reset --hard &&
87 git checkout baseline^0 &&
88 git merge -s recursive test2 &&
89 test -h a/b-2 &&
90 test -f a/b/c/d
93 test_done