3 test_description
='git p4 fetching changes in multiple blocks'
7 test_expect_success
'start p4d' '
11 test_expect_success
'Create a repo with many changes' '
13 client_view "//depot/included/... //client/included/..." \
14 "//depot/excluded/... //client/excluded/..." &&
15 mkdir -p "$cli/included" "$cli/excluded" &&
19 p4 submit -d "Add file.txt" &&
20 for i in $(test_seq 0 5)
24 p4 submit -d "Adding outer$i.txt" &&
25 for j in $(test_seq 0 5)
28 echo $i$j >file.txt &&
29 p4 submit -d "Commit $i$j" || exit
35 test_expect_success
'Clone the repo' '
36 git p4 clone --dest="$git" --changes-block-size=7 --verbose //depot/included@all
39 test_expect_success
'All files are present' '
40 echo file.txt >expected &&
41 test_write_lines outer0.txt outer1.txt outer2.txt outer3.txt outer4.txt >>expected &&
42 test_write_lines outer5.txt >>expected &&
44 test_cmp expected current
47 test_expect_success
'file.txt is correct' '
49 test_cmp expected "$git/file.txt"
52 test_expect_success
'Correct number of commits' '
53 (cd "$git" && git log --oneline) >log &&
55 test_line_count = 43 log
58 test_expect_success
'Previous version of file.txt is correct' '
59 (cd "$git" && git checkout HEAD^^) &&
61 test_cmp expected "$git/file.txt"
64 # Test git-p4 sync, with some files outside the client specification.
70 p4 submit
-d "Added a file" $1
74 test_expect_success
'Add some more files' '
75 for i in $(test_seq 0 10)
77 p4_add_file "included/x$i" &&
78 p4_add_file "excluded/x$i"
80 for i in $(test_seq 0 10)
82 p4_add_file "excluded/y$i"
86 # This should pick up the 10 new files in "included", but not be confused
87 # by the additional files in "excluded"
88 test_expect_success
'Syncing files' '
91 git p4 sync --changes-block-size=7 &&
92 git checkout p4/master &&
94 test_line_count = 11 log
98 test_expect_success
'kill p4d' '