Sync with 2.4.3
[git.git] / t / t9818-git-p4-block.sh
blob153b20afbd420f23e2379e2de1e3f4ea95eecd65
1 #!/bin/sh
3 test_description='git p4 fetching changes in multiple blocks'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 test_expect_success 'Create a repo with ~100 changes' '
13 cd "$cli" &&
14 >file.txt &&
15 p4 add file.txt &&
16 p4 submit -d "Add file.txt" &&
17 for i in $(test_seq 0 9)
19 >outer$i.txt &&
20 p4 add outer$i.txt &&
21 p4 submit -d "Adding outer$i.txt" &&
22 for j in $(test_seq 0 9)
24 p4 edit file.txt &&
25 echo $i$j >file.txt &&
26 p4 submit -d "Commit $i$j" || exit
27 done || exit
28 done
32 test_expect_success 'Clone the repo' '
33 git p4 clone --dest="$git" --changes-block-size=10 --verbose //depot@all
36 test_expect_success 'All files are present' '
37 echo file.txt >expected &&
38 test_write_lines outer0.txt outer1.txt outer2.txt outer3.txt outer4.txt >>expected &&
39 test_write_lines outer5.txt outer6.txt outer7.txt outer8.txt outer9.txt >>expected &&
40 ls "$git" >current &&
41 test_cmp expected current
44 test_expect_success 'file.txt is correct' '
45 echo 99 >expected &&
46 test_cmp expected "$git/file.txt"
49 test_expect_success 'Correct number of commits' '
50 (cd "$git" && git log --oneline) >log &&
51 test_line_count = 111 log
54 test_expect_success 'Previous version of file.txt is correct' '
55 (cd "$git" && git checkout HEAD^^) &&
56 echo 97 >expected &&
57 test_cmp expected "$git/file.txt"
60 test_expect_success 'kill p4d' '
61 kill_p4d
64 test_done