@@ -132,6 +132,9 @@ test_expect_success 'detect copies' '
132132 cd "$git" &&
133133 git config git-p4.skipSubmitEdit true &&
134134
135+ echo "file8" >>file2 &&
136+ git commit -a -m "Differentiate file2" &&
137+ git p4 submit &&
135138 cp file2 file8 &&
136139 git add file8 &&
137140 git commit -a -m "Copy file2 to file8" &&
@@ -140,6 +143,10 @@ test_expect_success 'detect copies' '
140143 p4 filelog //depot/file8 &&
141144 p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
142145
146+ echo "file9" >>file2 &&
147+ git commit -a -m "Differentiate file2" &&
148+ git p4 submit &&
149+
143150 cp file2 file9 &&
144151 git add file9 &&
145152 git commit -a -m "Copy file2 to file9" &&
@@ -149,25 +156,39 @@ test_expect_success 'detect copies' '
149156 p4 filelog //depot/file9 &&
150157 p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
151158
159+ echo "file10" >>file2 &&
160+ git commit -a -m "Differentiate file2" &&
161+ git p4 submit &&
162+
152163 echo "file2" >>file2 &&
153164 cp file2 file10 &&
154165 git add file2 file10 &&
155166 git commit -a -m "Modify and copy file2 to file10" &&
156167 git diff-tree -r -C HEAD &&
168+ src=$(git diff-tree -r -C HEAD | sed 1d | sed 2d | cut -f2) &&
169+ test "$src" = file2 &&
157170 git p4 submit &&
158171 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 &&
160177
161178 cp file2 file11 &&
162179 git add file11 &&
163180 git commit -a -m "Copy file2 to file11" &&
164181 git diff-tree -r -C --find-copies-harder HEAD &&
165182 src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
166- test "$src" = file10 &&
183+ test "$src" = file2 &&
167184 git config git-p4.detectCopiesHarder true &&
168185 git p4 submit &&
169186 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 &&
171192
172193 cp file2 file12 &&
173194 echo "some text" >>file12 &&
@@ -177,15 +198,16 @@ test_expect_success 'detect copies' '
177198 level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
178199 test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
179200 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 &&
184202 git config git-p4.detectCopies $(($level + 2)) &&
185203 git p4 submit &&
186204 p4 filelog //depot/file12 &&
187205 p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
188206
207+ echo "file13" >>file2 &&
208+ git commit -a -m "Differentiate file2" &&
209+ git p4 submit &&
210+
189211 cp file2 file13 &&
190212 echo "different text" >>file13 &&
191213 git add file13 &&
@@ -194,14 +216,11 @@ test_expect_success 'detect copies' '
194216 level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
195217 test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
196218 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 &&
201220 git config git-p4.detectCopies $(($level - 2)) &&
202221 git p4 submit &&
203222 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 "
205224 )
206225'
207226
0 commit comments