@@ -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,28 +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- case "$src" in
167- file2 | file10) : ;; # happy
168- *) false ;; # not
169- esac &&
183+ test "$src" = file2 &&
170184 git config git-p4.detectCopiesHarder true &&
171185 git p4 submit &&
172186 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 &&
174192
175193 cp file2 file12 &&
176194 echo "some text" >>file12 &&
@@ -180,15 +198,16 @@ test_expect_success 'detect copies' '
180198 level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
181199 test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
182200 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 &&
187202 git config git-p4.detectCopies $(($level + 2)) &&
188203 git p4 submit &&
189204 p4 filelog //depot/file12 &&
190205 p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
191206
207+ echo "file13" >>file2 &&
208+ git commit -a -m "Differentiate file2" &&
209+ git p4 submit &&
210+
192211 cp file2 file13 &&
193212 echo "different text" >>file13 &&
194213 git add file13 &&
@@ -197,14 +216,11 @@ test_expect_success 'detect copies' '
197216 level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
198217 test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
199218 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 &&
204220 git config git-p4.detectCopies $(($level - 2)) &&
205221 git p4 submit &&
206222 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 "
208224 )
209225'
210226
0 commit comments