git-p4: Verify detection of "empty" branch creation
Current implementation of new branch parent detection works on the principle that the new branch is a complete integration, with no changes, of the original files. This test shows this deficiency in the particular case when the new branch is created from a subset of the original files. 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
ad71f6617e7605315a225a1fce5e6e6a12042d04
1 file changed
+54
t/t9801-git-p4-branch.sh
+54
@@ -358,6 +358,60 @@ test_expect_success 'git p4 sync changes to two branches in the same changelist'
358
)
359
'
360
361
+# Create a branch by integrating a single file
362
+test_expect_success 'git p4 file subset branch' '
363
+ (
364
+ cd "$cli" &&
365
+ p4 integrate //depot/branch1/file1 //depot/branch6/file1 &&
366
+ p4 submit -d "Integrate file1 alone from branch1 to branch6"
367
+ )
368
+'
369
+
370
+# Check if git p4 creates a new branch containing a single file,
371
+# instead of keeping the old files from the original branch
372
+test_expect_failure 'git p4 clone file subset branch' '
373
+ test_when_finished cleanup_git &&
374
+ test_create_repo "$git" &&
375
+ (
376
+ cd "$git" &&
377
+ git config git-p4.branchList branch1:branch2 &&
378
+ git config --add git-p4.branchList branch1:branch3 &&
379
+ git config --add git-p4.branchList branch1:branch4 &&
380
+ git config --add git-p4.branchList branch1:branch5 &&
381
+ git config --add git-p4.branchList branch1:branch6 &&
382
+ git p4 clone --dest=. --detect-branches //depot@all &&
383
+ git log --all --graph --decorate --stat &&
384
+ git reset --hard p4/depot/branch1 &&
385
+ test_path_is_file file1 &&
386
+ test_path_is_file file2 &&
387
+ test_path_is_file file3 &&
388
+ grep update file2 &&
389
+ git reset --hard p4/depot/branch2 &&
390
+ test_path_is_file file1 &&
391
+ test_path_is_file file2 &&
392
+ test_path_is_missing file3 &&
393
+ ! grep update file2 &&
394
+ git reset --hard p4/depot/branch3 &&
395
+ test_path_is_file file1 &&
396
+ test_path_is_file file2 &&
397
+ test_path_is_missing file3 &&
398
+ grep update file2 &&
399
+ git reset --hard p4/depot/branch4 &&
400
+ test_path_is_file file1 &&
401
+ test_path_is_file file2 &&
402
+ test_path_is_file file3 &&
403
+ ! grep update file2 &&
404
+ git reset --hard p4/depot/branch5 &&
405
+ test_path_is_file file1 &&
406
+ test_path_is_file file2 &&
407
+ test_path_is_file file3 &&
408
+ ! grep update file2 &&
409
+ git reset --hard p4/depot/branch6 &&
410
+ test_path_is_file file1 &&
411
+ test_path_is_missing file2 &&
412
+ test_path_is_missing file3
413
+ )
414
+'
415
test_expect_success 'kill p4d' '
416
kill_p4d
417
'