@@ -132,6 +132,9 @@ test_expect_success 'detect copies' '
132
132
cd "$git" &&
133
133
git config git-p4.skipSubmitEdit true &&
134
134
135
+ echo "file8" >>file2 &&
136
+ git commit -a -m "Differentiate file2" &&
137
+ git p4 submit &&
135
138
cp file2 file8 &&
136
139
git add file8 &&
137
140
git commit -a -m "Copy file2 to file8" &&
@@ -140,6 +143,10 @@ test_expect_success 'detect copies' '
140
143
p4 filelog //depot/file8 &&
141
144
p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
142
145
146
+ echo "file9" >>file2 &&
147
+ git commit -a -m "Differentiate file2" &&
148
+ git p4 submit &&
149
+
143
150
cp file2 file9 &&
144
151
git add file9 &&
145
152
git commit -a -m "Copy file2 to file9" &&
@@ -149,25 +156,39 @@ test_expect_success 'detect copies' '
149
156
p4 filelog //depot/file9 &&
150
157
p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
151
158
159
+ echo "file10" >>file2 &&
160
+ git commit -a -m "Differentiate file2" &&
161
+ git p4 submit &&
162
+
152
163
echo "file2" >>file2 &&
153
164
cp file2 file10 &&
154
165
git add file2 file10 &&
155
166
git commit -a -m "Modify and copy file2 to file10" &&
156
167
git diff-tree -r -C HEAD &&
168
+ src=$(git diff-tree -r -C HEAD | sed 1d | sed 2d | cut -f2) &&
169
+ test "$src" = file2 &&
157
170
git p4 submit &&
158
171
p4 filelog //depot/file10 &&
159
- p4 filelog //depot/file10 | grep -q "branch from //depot/file" &&
172
+ p4 filelog //depot/file10 | grep -q "branch from //depot/file2" &&
173
+
174
+ echo "file11" >>file2 &&
175
+ git commit -a -m "Differentiate file2" &&
176
+ git p4 submit &&
160
177
161
178
cp file2 file11 &&
162
179
git add file11 &&
163
180
git commit -a -m "Copy file2 to file11" &&
164
181
git diff-tree -r -C --find-copies-harder HEAD &&
165
182
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
166
- test "$src" = file10 &&
183
+ test "$src" = file2 &&
167
184
git config git-p4.detectCopiesHarder true &&
168
185
git p4 submit &&
169
186
p4 filelog //depot/file11 &&
170
- p4 filelog //depot/file11 | grep -q "branch from //depot/file" &&
187
+ p4 filelog //depot/file11 | grep -q "branch from //depot/file2" &&
188
+
189
+ echo "file12" >>file2 &&
190
+ git commit -a -m "Differentiate file2" &&
191
+ git p4 submit &&
171
192
172
193
cp file2 file12 &&
173
194
echo "some text" >>file12 &&
@@ -177,15 +198,16 @@ test_expect_success 'detect copies' '
177
198
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
178
199
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
179
200
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
180
- case "$src" in
181
- file10 | file11) : ;; # happy
182
- *) false ;; # not
183
- &&
201
+ test "$src" = file2 &&
184
202
git config git-p4.detectCopies $(($level + 2)) &&
185
203
git p4 submit &&
186
204
p4 filelog //depot/file12 &&
187
205
p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
188
206
207
+ echo "file13" >>file2 &&
208
+ git commit -a -m "Differentiate file2" &&
209
+ git p4 submit &&
210
+
189
211
cp file2 file13 &&
190
212
echo "different text" >>file13 &&
191
213
git add file13 &&
@@ -194,14 +216,11 @@ test_expect_success 'detect copies' '
194
216
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
195
217
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
196
218
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
197
- case "$src" in
198
- file10 | file11 | file12) : ;; # happy
199
- *) false ;; # not
200
- &&
219
+ test "$src" = file2 &&
201
220
git config git-p4.detectCopies $(($level - 2)) &&
202
221
git p4 submit &&
203
222
p4 filelog //depot/file13 &&
204
- p4 filelog //depot/file13 | grep -q "branch from //depot/file "
223
+ p4 filelog //depot/file13 | grep -q "branch from //depot/file2 "
205
224
)
206
225
'
207
226
0 commit comments