@@ -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,28 +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
- case "$src" in
167
- file2 | file10) : ;; # happy
168
- *) false ;; # not
169
- esac &&
183
+ test "$src" = file2 &&
170
184
git config git-p4.detectCopiesHarder true &&
171
185
git p4 submit &&
172
186
p4 filelog //depot/file11 &&
173
- 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 &&
174
192
175
193
cp file2 file12 &&
176
194
echo "some text" >>file12 &&
@@ -180,15 +198,16 @@ test_expect_success 'detect copies' '
180
198
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
181
199
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
182
200
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
183
- case "$src" in
184
- file10 | file11) : ;; # happy
185
- *) false ;; # not
186
- esac &&
201
+ test "$src" = file2 &&
187
202
git config git-p4.detectCopies $(($level + 2)) &&
188
203
git p4 submit &&
189
204
p4 filelog //depot/file12 &&
190
205
p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
191
206
207
+ echo "file13" >>file2 &&
208
+ git commit -a -m "Differentiate file2" &&
209
+ git p4 submit &&
210
+
192
211
cp file2 file13 &&
193
212
echo "different text" >>file13 &&
194
213
git add file13 &&
@@ -197,14 +216,11 @@ test_expect_success 'detect copies' '
197
216
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
198
217
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
199
218
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
200
- case "$src" in
201
- file10 | file11 | file12) : ;; # happy
202
- *) false ;; # not
203
- esac &&
219
+ test "$src" = file2 &&
204
220
git config git-p4.detectCopies $(($level - 2)) &&
205
221
git p4 submit &&
206
222
p4 filelog //depot/file13 &&
207
- p4 filelog //depot/file13 | grep -q "branch from //depot/file "
223
+ p4 filelog //depot/file13 | grep -q "branch from //depot/file2 "
208
224
)
209
225
'
210
226
0 commit comments