提交 a8f49338 编写于 作者: J Junio C Hamano

Merge branch 'va/git-p4-test'

By Vitor Antunes
* va/git-p4-test:
  git-p4: Clean up branch test cases
  git-p4: Verify detection of "empty" branch creation
  git-p4: Test changelists touching two branches
......@@ -218,7 +218,7 @@ test_expect_success 'git p4 clone simple branches' '
cd branch1 &&
p4 edit file2 &&
echo file2_ >>file2 &&
p4 submit -d "update file2 in branch3" &&
p4 submit -d "update file2 in branch1" &&
cd "$git" &&
git reset --hard p4/depot/branch1 &&
git p4 rebase &&
......@@ -249,8 +249,6 @@ test_expect_success 'git p4 clone simple branches' '
# `- file2
# `- file3
test_expect_success 'git p4 add complex branches' '
test_when_finished cleanup_git &&
test_create_repo "$git" &&
(
cd "$cli" &&
changelist=$(p4 changes -m1 //depot/... | cut -d" " -f2) &&
......@@ -306,6 +304,112 @@ test_expect_success 'git p4 clone complex branches' '
)
'
# Move branch3/file3 to branch4/file3 in a single changelist
test_expect_success 'git p4 submit to two branches in a single changelist' '
(
cd "$cli" &&
p4 integrate //depot/branch3/file3 //depot/branch4/file3 &&
p4 delete //depot/branch3/file3 &&
p4 submit -d "Move branch3/file3 to branch4/file3"
)
'
# Confirm that changes to two branches done in a single changelist
# are correctly imported by git p4
test_expect_success 'git p4 sync changes to two branches in the same changelist' '
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 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 &&
test_path_is_missing .git/git-p4-tmp
)
'
# 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
'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册