git-p4: Test changelists touching two branches

It is possible to modify two different branches in P4 in a single changelist. git-p4 correctly detects this and commits the relevant changes to the different branches separately. This test proves that and avoid future regressions in this behavior. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Vitor Antunes committed May 26, 2012 at 10:56 UTC 9e826dfd57cb6f8d2a2f78c42b8153724dc2ea0e
1 file changed +52
t/t9801-git-p4-branch.sh
+52
@@ -306,6 +306,58 @@ test_expect_success 'git p4 clone complex branches' '
306 )
307 '
308
309 +# Move branch3/file3 to branch4/file3 in a single changelist
310 +test_expect_success 'git p4 submit to two branches in a single changelist' '
311 + (
312 + cd "$cli" &&
313 + p4 integrate //depot/branch3/file3 //depot/branch4/file3 &&
314 + p4 delete //depot/branch3/file3 &&
315 + p4 submit -d "Move branch3/file3 to branch4/file3"
316 + )
317 +'
318 +
319 +# Confirm that changes to two branches done in a single changelist
320 +# are correctly imported by git p4
321 +test_expect_success 'git p4 sync changes to two branches in the same changelist' '
322 + test_when_finished cleanup_git &&
323 + test_create_repo "$git" &&
324 + (
325 + cd "$git" &&
326 + git config git-p4.branchList branch1:branch2 &&
327 + git config --add git-p4.branchList branch1:branch3 &&
328 + git config --add git-p4.branchList branch1:branch4 &&
329 + git config --add git-p4.branchList branch1:branch5 &&
330 + git p4 clone --dest=. --detect-branches //depot@all &&
331 + git log --all --graph --decorate --stat &&
332 + git reset --hard p4/depot/branch1 &&
333 + test_path_is_file file1 &&
334 + test_path_is_file file2 &&
335 + test_path_is_file file3 &&
336 + grep update file2 &&
337 + git reset --hard p4/depot/branch2 &&
338 + test_path_is_file file1 &&
339 + test_path_is_file file2 &&
340 + test_path_is_missing file3 &&
341 + ! grep update file2 &&
342 + git reset --hard p4/depot/branch3 &&
343 + test_path_is_file file1 &&
344 + test_path_is_file file2 &&
345 + test_path_is_missing file3 &&
346 + grep update file2 &&
347 + git reset --hard p4/depot/branch4 &&
348 + test_path_is_file file1 &&
349 + test_path_is_file file2 &&
350 + test_path_is_file file3 &&
351 + ! grep update file2 &&
352 + git reset --hard p4/depot/branch5 &&
353 + test_path_is_file file1 &&
354 + test_path_is_file file2 &&
355 + test_path_is_file file3 &&
356 + ! grep update file2 &&
357 + test_path_is_missing .git/git-p4-tmp
358 + )
359 +'
360 +
361 test_expect_success 'kill p4d' '
362 kill_p4d
363 '