X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft9800-git-p4.sh;h=01ba041fdefe61a3e712344bfe257a1b9cba3b4b;hb=5ec8217eb6c89974fda94808a310aa651577b25d;hp=9d4d4bfd90099a0260315674a66ab8706585e4c5;hpb=c5cd4ef0fd0838b3a7c97e53f361ba15db736138;p=git.git diff --git a/t/t9800-git-p4.sh b/t/t9800-git-p4.sh index 9d4d4bfd9..01ba041fd 100755 --- a/t/t9800-git-p4.sh +++ b/t/t9800-git-p4.sh @@ -405,6 +405,67 @@ test_expect_success 'detect copies' ' p4 filelog //depot/file13 | grep -q "branch from //depot/file" ' +# Create a simple branch structure in P4 depot to check if it is correctly +# cloned. +test_expect_success 'add simple p4 branches' ' + cd "$cli" && + mkdir branch1 && + cd branch1 && + echo file1 >file1 && + echo file2 >file2 && + p4 add file1 file2 && + p4 submit -d "branch1" && + p4 integrate //depot/branch1/... //depot/branch2/... && + p4 submit -d "branch2" && + echo file3 >file3 && + p4 add file3 && + p4 submit -d "add file3 in branch1" && + p4 open file2 && + echo update >>file2 && + p4 submit -d "update file2 in branch1" && + p4 integrate //depot/branch1/... //depot/branch3/... && + p4 submit -d "branch3" && + cd "$TRASH_DIRECTORY" +' + +# Configure branches through git-config and clone them. +# All files are tested to make sure branches were cloned correctly. +# Finally, make an update to branch1 on P4 side to check if it is imported +# correctly by git-p4. +test_expect_success 'git-p4 clone simple branches' ' + 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 && + "$GITP4" clone --dest=. --detect-branches //depot@all && + git log --all --graph --decorate --stat && + git reset --hard p4/depot/branch1 && + test -f file1 && + test -f file2 && + test -f file3 && + grep -q update file2 && + git reset --hard p4/depot/branch2 && + test -f file1 && + test -f file2 && + test ! -f file3 && + ! grep -q update file2 && + git reset --hard p4/depot/branch3 && + test -f file1 && + test -f file2 && + test -f file3 && + grep -q update file2 && + cd "$cli" && + cd branch1 && + p4 edit file2 && + echo file2_ >>file2 && + p4 submit -d "update file2 in branch1" && + cd "$git" && + git reset --hard p4/depot/branch1 && + "$GITP4" rebase && + grep -q file2_ file2 +' + test_expect_success 'shutdown' ' pid=`pgrep -f p4d` && test -n "$pid" &&