summaryrefslogtreecommitdiff
path: root/t/t9801-git-p4-branch.sh
diff options
context:
space:
mode:
authorVitor Antunes <vitor.hda@gmail.com>2012-05-26 10:56:05 +0100
committerJunio C Hamano <gitster@pobox.com>2012-05-29 10:46:00 -0700
commitad71f6617e7605315a225a1fce5e6e6a12042d04 (patch)
tree1517be74c8951fb3b69ae769b8a893f89afe2204 /t/t9801-git-p4-branch.sh
parent9e826dfd57cb6f8d2a2f78c42b8153724dc2ea0e (diff)
downloadgit-ad71f6617e7605315a225a1fce5e6e6a12042d04.tar.gz
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>
Diffstat (limited to 't/t9801-git-p4-branch.sh')
-rwxr-xr-xt/t9801-git-p4-branch.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 0ae86075f1..308b123cfd 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -358,6 +358,60 @@ test_expect_success 'git p4 sync changes to two branches in the same changelist'
)
'
+# Create a branch by integrating a single file
+test_expect_success 'git p4 file subset branch' '
+ (
+ cd "$cli" &&
+ p4 integrate //depot/branch1/file1 //depot/branch6/file1 &&
+ p4 submit -d "Integrate file1 alone from branch1 to branch6"
+ )
+'
+
+# Check if git p4 creates a new branch containing a single file,
+# instead of keeping the old files from the original branch
+test_expect_failure 'git p4 clone file subset branch' '
+ test_when_finished cleanup_git &&
+ test_create_repo "$git" &&
+ (
+ cd "$git" &&
+ git config git-p4.branchList branch1:branch2 &&
+ git config --add git-p4.branchList branch1:branch3 &&
+ git config --add git-p4.branchList branch1:branch4 &&
+ git config --add git-p4.branchList branch1:branch5 &&
+ git config --add git-p4.branchList branch1:branch6 &&
+ git p4 clone --dest=. --detect-branches //depot@all &&
+ git log --all --graph --decorate --stat &&
+ git reset --hard p4/depot/branch1 &&
+ test_path_is_file file1 &&
+ test_path_is_file file2 &&
+ test_path_is_file file3 &&
+ grep update file2 &&
+ git reset --hard p4/depot/branch2 &&
+ test_path_is_file file1 &&
+ test_path_is_file file2 &&
+ test_path_is_missing file3 &&
+ ! grep update file2 &&
+ git reset --hard p4/depot/branch3 &&
+ test_path_is_file file1 &&
+ test_path_is_file file2 &&
+ test_path_is_missing file3 &&
+ grep update file2 &&
+ git reset --hard p4/depot/branch4 &&
+ test_path_is_file file1 &&
+ test_path_is_file file2 &&
+ test_path_is_file file3 &&
+ ! grep update file2 &&
+ git reset --hard p4/depot/branch5 &&
+ test_path_is_file file1 &&
+ test_path_is_file file2 &&
+ test_path_is_file file3 &&
+ ! grep update file2 &&
+ git reset --hard p4/depot/branch6 &&
+ test_path_is_file file1 &&
+ test_path_is_missing file2 &&
+ test_path_is_missing file3
+ )
+'
test_expect_success 'kill p4d' '
kill_p4d
'