Skip to content

Commit a8f4933

Browse files
committed
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
2 parents 261ec7d + 5d5c556 commit a8f4933

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

t/t9801-git-p4-branch.sh

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ test_expect_success 'git p4 clone simple branches' '
218218
cd branch1 &&
219219
p4 edit file2 &&
220220
echo file2_ >>file2 &&
221-
p4 submit -d "update file2 in branch3" &&
221+
p4 submit -d "update file2 in branch1" &&
222222
cd "$git" &&
223223
git reset --hard p4/depot/branch1 &&
224224
git p4 rebase &&
@@ -249,8 +249,6 @@ test_expect_success 'git p4 clone simple branches' '
249249
# `- file2
250250
# `- file3
251251
test_expect_success 'git p4 add complex branches' '
252-
test_when_finished cleanup_git &&
253-
test_create_repo "$git" &&
254252
(
255253
cd "$cli" &&
256254
changelist=$(p4 changes -m1 //depot/... | cut -d" " -f2) &&
@@ -306,6 +304,112 @@ test_expect_success 'git p4 clone complex branches' '
306304
)
307305
'
308306

307+
# Move branch3/file3 to branch4/file3 in a single changelist
308+
test_expect_success 'git p4 submit to two branches in a single changelist' '
309+
(
310+
cd "$cli" &&
311+
p4 integrate //depot/branch3/file3 //depot/branch4/file3 &&
312+
p4 delete //depot/branch3/file3 &&
313+
p4 submit -d "Move branch3/file3 to branch4/file3"
314+
)
315+
'
316+
317+
# Confirm that changes to two branches done in a single changelist
318+
# are correctly imported by git p4
319+
test_expect_success 'git p4 sync changes to two branches in the same changelist' '
320+
test_when_finished cleanup_git &&
321+
test_create_repo "$git" &&
322+
(
323+
cd "$git" &&
324+
git config git-p4.branchList branch1:branch2 &&
325+
git config --add git-p4.branchList branch1:branch3 &&
326+
git config --add git-p4.branchList branch1:branch4 &&
327+
git config --add git-p4.branchList branch1:branch5 &&
328+
git p4 clone --dest=. --detect-branches //depot@all &&
329+
git log --all --graph --decorate --stat &&
330+
git reset --hard p4/depot/branch1 &&
331+
test_path_is_file file1 &&
332+
test_path_is_file file2 &&
333+
test_path_is_file file3 &&
334+
grep update file2 &&
335+
git reset --hard p4/depot/branch2 &&
336+
test_path_is_file file1 &&
337+
test_path_is_file file2 &&
338+
test_path_is_missing file3 &&
339+
! grep update file2 &&
340+
git reset --hard p4/depot/branch3 &&
341+
test_path_is_file file1 &&
342+
test_path_is_file file2 &&
343+
test_path_is_missing file3 &&
344+
grep update file2 &&
345+
git reset --hard p4/depot/branch4 &&
346+
test_path_is_file file1 &&
347+
test_path_is_file file2 &&
348+
test_path_is_file file3 &&
349+
! grep update file2 &&
350+
git reset --hard p4/depot/branch5 &&
351+
test_path_is_file file1 &&
352+
test_path_is_file file2 &&
353+
test_path_is_file file3 &&
354+
! grep update file2 &&
355+
test_path_is_missing .git/git-p4-tmp
356+
)
357+
'
358+
359+
# Create a branch by integrating a single file
360+
test_expect_success 'git p4 file subset branch' '
361+
(
362+
cd "$cli" &&
363+
p4 integrate //depot/branch1/file1 //depot/branch6/file1 &&
364+
p4 submit -d "Integrate file1 alone from branch1 to branch6"
365+
)
366+
'
367+
368+
# Check if git p4 creates a new branch containing a single file,
369+
# instead of keeping the old files from the original branch
370+
test_expect_failure 'git p4 clone file subset branch' '
371+
test_when_finished cleanup_git &&
372+
test_create_repo "$git" &&
373+
(
374+
cd "$git" &&
375+
git config git-p4.branchList branch1:branch2 &&
376+
git config --add git-p4.branchList branch1:branch3 &&
377+
git config --add git-p4.branchList branch1:branch4 &&
378+
git config --add git-p4.branchList branch1:branch5 &&
379+
git config --add git-p4.branchList branch1:branch6 &&
380+
git p4 clone --dest=. --detect-branches //depot@all &&
381+
git log --all --graph --decorate --stat &&
382+
git reset --hard p4/depot/branch1 &&
383+
test_path_is_file file1 &&
384+
test_path_is_file file2 &&
385+
test_path_is_file file3 &&
386+
grep update file2 &&
387+
git reset --hard p4/depot/branch2 &&
388+
test_path_is_file file1 &&
389+
test_path_is_file file2 &&
390+
test_path_is_missing file3 &&
391+
! grep update file2 &&
392+
git reset --hard p4/depot/branch3 &&
393+
test_path_is_file file1 &&
394+
test_path_is_file file2 &&
395+
test_path_is_missing file3 &&
396+
grep update file2 &&
397+
git reset --hard p4/depot/branch4 &&
398+
test_path_is_file file1 &&
399+
test_path_is_file file2 &&
400+
test_path_is_file file3 &&
401+
! grep update file2 &&
402+
git reset --hard p4/depot/branch5 &&
403+
test_path_is_file file1 &&
404+
test_path_is_file file2 &&
405+
test_path_is_file file3 &&
406+
! grep update file2 &&
407+
git reset --hard p4/depot/branch6 &&
408+
test_path_is_file file1 &&
409+
test_path_is_missing file2 &&
410+
test_path_is_missing file3
411+
)
412+
'
309413
test_expect_success 'kill p4d' '
310414
kill_p4d
311415
'

0 commit comments

Comments
 (0)