@@ -8,18 +8,21 @@ test_expect_success 'start p4d' '
8
8
start_p4d
9
9
'
10
10
11
- test_expect_success ' Create a repo with ~100 changes' '
11
+ test_expect_success ' Create a repo with many changes' '
12
12
(
13
- cd "$cli" &&
13
+ client_view "//depot/included/... //client/included/..." \
14
+ "//depot/excluded/... //client/excluded/..." &&
15
+ mkdir -p "$cli/included" "$cli/excluded" &&
16
+ cd "$cli/included" &&
14
17
>file.txt &&
15
18
p4 add file.txt &&
16
19
p4 submit -d "Add file.txt" &&
17
- for i in $(test_seq 0 9 )
20
+ for i in $(test_seq 0 5 )
18
21
do
19
22
>outer$i.txt &&
20
23
p4 add outer$i.txt &&
21
24
p4 submit -d "Adding outer$i.txt" &&
22
- for j in $(test_seq 0 9 )
25
+ for j in $(test_seq 0 5 )
23
26
do
24
27
p4 edit file.txt &&
25
28
echo $i$j >file.txt &&
@@ -30,33 +33,68 @@ test_expect_success 'Create a repo with ~100 changes' '
30
33
'
31
34
32
35
test_expect_success ' Clone the repo' '
33
- git p4 clone --dest="$git" --changes-block-size=10 --verbose //depot@all
36
+ git p4 clone --dest="$git" --changes-block-size=7 --verbose //depot/included @all
34
37
'
35
38
36
39
test_expect_success ' All files are present' '
37
40
echo file.txt >expected &&
38
41
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 &&
42
+ test_write_lines outer5.txt >>expected &&
40
43
ls "$git" >current &&
41
44
test_cmp expected current
42
45
'
43
46
44
47
test_expect_success ' file.txt is correct' '
45
- echo 99 >expected &&
48
+ echo 55 >expected &&
46
49
test_cmp expected "$git/file.txt"
47
50
'
48
51
49
52
test_expect_success ' Correct number of commits' '
50
53
(cd "$git" && git log --oneline) >log &&
51
- test_line_count = 111 log
54
+ wc -l log &&
55
+ test_line_count = 43 log
52
56
'
53
57
54
58
test_expect_success ' Previous version of file.txt is correct' '
55
59
(cd "$git" && git checkout HEAD^^) &&
56
- echo 97 >expected &&
60
+ echo 53 >expected &&
57
61
test_cmp expected "$git/file.txt"
58
62
'
59
63
64
+ # Test git-p4 sync, with some files outside the client specification.
65
+
66
+ p4_add_file () {
67
+ (cd " $cli " &&
68
+ > $1 &&
69
+ p4 add $1 &&
70
+ p4 submit -d " Added a file" $1
71
+ )
72
+ }
73
+
74
+ test_expect_success ' Add some more files' '
75
+ for i in $(test_seq 0 10)
76
+ do
77
+ p4_add_file "included/x$i" &&
78
+ p4_add_file "excluded/x$i"
79
+ done &&
80
+ for i in $(test_seq 0 10)
81
+ do
82
+ p4_add_file "excluded/y$i"
83
+ done
84
+ '
85
+
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' '
89
+ (
90
+ cd "$git" &&
91
+ git p4 sync --changes-block-size=7 &&
92
+ git checkout p4/master &&
93
+ ls -l x* > log &&
94
+ test_line_count = 11 log
95
+ )
96
+ '
97
+
60
98
test_expect_success ' kill p4d' '
61
99
kill_p4d
62
100
'
0 commit comments