3
3
test_description=' merging when a directory was replaced with a symlink'
4
4
. ./test-lib.sh
5
5
6
- test_expect_success SYMLINKS ' create a commit where dir a/b changed to symlink' '
6
+ test_expect_success ' create a commit where dir a/b changed to symlink' '
7
7
mkdir -p a/b/c a/b-2/c &&
8
8
> a/b/c/d &&
9
9
> a/b-2/c/d &&
@@ -12,20 +12,20 @@ test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink'
12
12
git commit -m base &&
13
13
git tag start &&
14
14
rm -rf a/b &&
15
- ln -s b-2 a/b &&
16
15
git add -A &&
16
+ test_ln_s_add b-2 a/b &&
17
17
git commit -m "dir to symlink"
18
18
'
19
19
20
- test_expect_success SYMLINKS ' checkout does not clobber untracked symlink' '
20
+ test_expect_success ' checkout does not clobber untracked symlink' '
21
21
git checkout HEAD^0 &&
22
22
git reset --hard master &&
23
23
git rm --cached a/b &&
24
24
git commit -m "untracked symlink remains" &&
25
25
test_must_fail git checkout start^0
26
26
'
27
27
28
- test_expect_success SYMLINKS ' a/b-2/c/d is kept when clobbering symlink b' '
28
+ test_expect_success ' a/b-2/c/d is kept when clobbering symlink b' '
29
29
git checkout HEAD^0 &&
30
30
git reset --hard master &&
31
31
git rm --cached a/b &&
@@ -34,14 +34,14 @@ test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' '
34
34
test -f a/b-2/c/d
35
35
'
36
36
37
- test_expect_success SYMLINKS ' checkout should not have deleted a/b-2/c/d' '
37
+ test_expect_success ' checkout should not have deleted a/b-2/c/d' '
38
38
git checkout HEAD^0 &&
39
39
git reset --hard master &&
40
40
git checkout start^0 &&
41
41
test -f a/b-2/c/d
42
42
'
43
43
44
- test_expect_success SYMLINKS ' setup for merge test' '
44
+ test_expect_success ' setup for merge test' '
45
45
git reset --hard &&
46
46
test -f a/b-2/c/d &&
47
47
echo x > a/x &&
@@ -50,39 +50,51 @@ test_expect_success SYMLINKS 'setup for merge test' '
50
50
git tag baseline
51
51
'
52
52
53
- test_expect_success SYMLINKS ' Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
53
+ test_expect_success ' Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
54
54
git reset --hard &&
55
55
git checkout baseline^0 &&
56
56
git merge -s resolve master &&
57
- test -h a/b &&
58
57
test -f a/b-2/c/d
59
58
'
60
59
61
- test_expect_success SYMLINKS ' Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
60
+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
61
+ test -h a/b
62
+ '
63
+
64
+ test_expect_success ' Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
62
65
git reset --hard &&
63
66
git checkout baseline^0 &&
64
67
git merge -s recursive master &&
65
- test -h a/b &&
66
68
test -f a/b-2/c/d
67
69
'
68
70
69
- test_expect_success SYMLINKS ' Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
71
+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
72
+ test -h a/b
73
+ '
74
+
75
+ test_expect_success ' Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
70
76
git reset --hard &&
71
77
git checkout master^0 &&
72
78
git merge -s resolve baseline^0 &&
73
- test -h a/b &&
74
79
test -f a/b-2/c/d
75
80
'
76
81
77
- test_expect_success SYMLINKS ' Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
82
+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
83
+ test -h a/b
84
+ '
85
+
86
+ test_expect_success ' Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
78
87
git reset --hard &&
79
88
git checkout master^0 &&
80
89
git merge -s recursive baseline^0 &&
81
- test -h a/b &&
82
90
test -f a/b-2/c/d
83
91
'
84
92
85
- test_expect_failure SYMLINKS ' do not lose untracked in merge (resolve)' '
93
+ test_expect_success SYMLINKS ' a/b was resolved as symlink' '
94
+ test -h a/b
95
+ '
96
+
97
+ test_expect_failure ' do not lose untracked in merge (resolve)' '
86
98
git reset --hard &&
87
99
git checkout baseline^0 &&
88
100
>a/b/c/e &&
@@ -91,7 +103,7 @@ test_expect_failure SYMLINKS 'do not lose untracked in merge (resolve)' '
91
103
test -f a/b-2/c/d
92
104
'
93
105
94
- test_expect_success SYMLINKS ' do not lose untracked in merge (recursive)' '
106
+ test_expect_success ' do not lose untracked in merge (recursive)' '
95
107
git reset --hard &&
96
108
git checkout baseline^0 &&
97
109
>a/b/c/e &&
@@ -100,52 +112,61 @@ test_expect_success SYMLINKS 'do not lose untracked in merge (recursive)' '
100
112
test -f a/b-2/c/d
101
113
'
102
114
103
- test_expect_success SYMLINKS ' do not lose modifications in merge (resolve)' '
115
+ test_expect_success ' do not lose modifications in merge (resolve)' '
104
116
git reset --hard &&
105
117
git checkout baseline^0 &&
106
118
echo more content >>a/b/c/d &&
107
119
test_must_fail git merge -s resolve master
108
120
'
109
121
110
- test_expect_success SYMLINKS ' do not lose modifications in merge (recursive)' '
122
+ test_expect_success ' do not lose modifications in merge (recursive)' '
111
123
git reset --hard &&
112
124
git checkout baseline^0 &&
113
125
echo more content >>a/b/c/d &&
114
126
test_must_fail git merge -s recursive master
115
127
'
116
128
117
- test_expect_success SYMLINKS ' setup a merge where dir a/b-2 changed to symlink' '
129
+ test_expect_success ' setup a merge where dir a/b-2 changed to symlink' '
118
130
git reset --hard &&
119
131
git checkout start^0 &&
120
132
rm -rf a/b-2 &&
121
- ln -s b a/b-2 &&
122
133
git add -A &&
134
+ test_ln_s_add b a/b-2 &&
123
135
git commit -m "dir a/b-2 to symlink" &&
124
136
git tag test2
125
137
'
126
138
127
- test_expect_success SYMLINKS ' merge should not have D/F conflicts (resolve)' '
139
+ test_expect_success ' merge should not have D/F conflicts (resolve)' '
128
140
git reset --hard &&
129
141
git checkout baseline^0 &&
130
142
git merge -s resolve test2 &&
131
- test -h a/b-2 &&
132
143
test -f a/b/c/d
133
144
'
134
145
135
- test_expect_success SYMLINKS ' merge should not have D/F conflicts (recursive)' '
146
+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
147
+ test -h a/b-2
148
+ '
149
+
150
+ test_expect_success ' merge should not have D/F conflicts (recursive)' '
136
151
git reset --hard &&
137
152
git checkout baseline^0 &&
138
153
git merge -s recursive test2 &&
139
- test -h a/b-2 &&
140
154
test -f a/b/c/d
141
155
'
142
156
143
- test_expect_success SYMLINKS ' merge should not have F/D conflicts (recursive)' '
157
+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
158
+ test -h a/b-2
159
+ '
160
+
161
+ test_expect_success ' merge should not have F/D conflicts (recursive)' '
144
162
git reset --hard &&
145
163
git checkout -b foo test2 &&
146
164
git merge -s recursive baseline^0 &&
147
- test -h a/b-2 &&
148
165
test -f a/b/c/d
149
166
'
150
167
168
+ test_expect_success SYMLINKS ' a/b-2 was resolved as symlink' '
169
+ test -h a/b-2
170
+ '
171
+
151
172
test_done
0 commit comments