3 test_description
='git p4 fetching changes in multiple blocks'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'start p4d' '
12 create_restricted_group
() {
21 test_expect_success
'Create group with limited maxrows' '
22 create_restricted_group
25 test_expect_success
'Create a repo with many changes' '
27 client_view "//depot/included/... //client/included/..." \
28 "//depot/excluded/... //client/excluded/..." &&
29 mkdir -p "$cli/included" "$cli/excluded" &&
33 p4 submit -d "Add file.txt" &&
34 for i in $(test_seq 0 5)
38 p4 submit -d "Adding outer$i.txt" &&
39 for j in $(test_seq 0 5)
42 echo $i$j >file.txt &&
43 p4 submit -d "Commit $i$j" || exit
49 test_expect_success
'Default user cannot fetch changes' '
50 ! p4 changes -m 1 //depot/...
53 test_expect_success
'Clone the repo' '
54 git p4 clone --dest="$git" --changes-block-size=7 --verbose //depot/included@all
57 test_expect_success
'All files are present' '
58 echo file.txt >expected &&
59 test_write_lines outer0.txt outer1.txt outer2.txt outer3.txt outer4.txt >>expected &&
60 test_write_lines outer5.txt >>expected &&
62 test_cmp expected current
65 test_expect_success
'file.txt is correct' '
67 test_cmp expected "$git/file.txt"
70 test_expect_success
'Correct number of commits' '
71 (cd "$git" && git log --oneline) >log &&
73 test_line_count = 43 log
76 test_expect_success
'Previous version of file.txt is correct' '
77 (cd "$git" && git checkout HEAD^^) &&
79 test_cmp expected "$git/file.txt"
82 # Test git-p4 sync, with some files outside the client specification.
88 p4 submit
-d "Added file $1" $1
92 test_expect_success
'Add some more files' '
93 for i in $(test_seq 0 10)
95 p4_add_file "included/x$i" &&
96 p4_add_file "excluded/x$i" || return 1
98 for i in $(test_seq 0 10)
100 p4_add_file "excluded/y$i" || return 1
104 # This should pick up the 10 new files in "included", but not be confused
105 # by the additional files in "excluded"
106 test_expect_success
'Syncing files' '
109 git p4 sync --changes-block-size=7 &&
110 git checkout p4/master &&
112 test_line_count = 11 log
116 # Handling of multiple depot paths:
117 # git p4 clone //depot/pathA //depot/pathB
119 test_expect_success
'Create a repo with multiple depot paths' '
120 client_view "//depot/pathA/... //client/pathA/..." \
121 "//depot/pathB/... //client/pathB/..." &&
122 mkdir -p "$cli/pathA" "$cli/pathB" &&
125 for i in $(test_seq 1 10)
127 p4_add_file "$p/file$p$i" || return 1
132 test_expect_success
'Clone repo with multiple depot paths' '
133 test_when_finished cleanup_git &&
136 git p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \
137 --destination=dest &&
139 test_line_count = 20 log
143 test_expect_success
'Clone repo with self-sizing block size' '
144 test_when_finished cleanup_git &&
145 git p4 clone --changes-block-size=1000000 //depot@all --destination="$git" &&
146 git -C "$git" log --oneline >log &&
147 test_line_count \> 10 log