tag doc: move the description of --[no-]merged earlier
[git/raj.git] / t / t9821-git-p4-path-variations.sh
blob81e46acfa8ba10b8d0051acc1e7b19dc6b1de365
1 #!/bin/sh
3 test_description='Clone repositories with path case variations'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d with case folding enabled' '
8 start_p4d -C1
11 test_expect_success 'Create a repo with path case variations' '
12 client_view "//depot/... //client/..." &&
14 cd "$cli" &&
16 mkdir -p Path/to &&
17 >Path/to/File2.txt &&
18 p4 add Path/to/File2.txt &&
19 p4 submit -d "Add file2" &&
20 rm -rf Path &&
22 mkdir -p path/TO &&
23 >path/TO/file1.txt &&
24 p4 add path/TO/file1.txt &&
25 p4 submit -d "Add file1" &&
26 rm -rf path &&
28 mkdir -p path/to &&
29 >path/to/file3.txt &&
30 p4 add path/to/file3.txt &&
31 p4 submit -d "Add file3" &&
32 rm -rf path &&
34 mkdir -p x-outside-spec &&
35 >x-outside-spec/file4.txt &&
36 p4 add x-outside-spec/file4.txt &&
37 p4 submit -d "Add file4" &&
38 rm -rf x-outside-spec
42 test_expect_success 'Clone root' '
43 client_view "//depot/... //client/..." &&
44 test_when_finished cleanup_git &&
46 cd "$git" &&
47 git init . &&
48 git config core.ignorecase false &&
49 git p4 clone --use-client-spec --destination="$git" //depot &&
50 # This method is used instead of "test -f" to ensure the case is
51 # checked even if the test is executed on case-insensitive file systems.
52 # All files are there as expected although the path cases look random.
53 cat >expect <<-\EOF &&
54 Path/to/File2.txt
55 path/TO/file1.txt
56 path/to/file3.txt
57 x-outside-spec/file4.txt
58 EOF
59 git ls-files >actual &&
60 test_cmp expect actual
64 test_expect_success 'Clone root (ignorecase)' '
65 client_view "//depot/... //client/..." &&
66 test_when_finished cleanup_git &&
68 cd "$git" &&
69 git init . &&
70 git config core.ignorecase true &&
71 git p4 clone --use-client-spec --destination="$git" //depot &&
72 # This method is used instead of "test -f" to ensure the case is
73 # checked even if the test is executed on case-insensitive file systems.
74 # All files are there as expected although the path cases look random.
75 cat >expect <<-\EOF &&
76 path/TO/File2.txt
77 path/TO/file1.txt
78 path/TO/file3.txt
79 x-outside-spec/file4.txt
80 EOF
81 git ls-files >actual &&
82 test_cmp expect actual
86 test_expect_success 'Clone root and ignore one file' '
87 client_view \
88 "//depot/... //client/..." \
89 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
90 test_when_finished cleanup_git &&
92 cd "$git" &&
93 git init . &&
94 git config core.ignorecase false &&
95 git p4 clone --use-client-spec --destination="$git" //depot &&
96 # We ignore one file in the client spec and all path cases change from
97 # "TO" to "to"!
98 cat >expect <<-\EOF &&
99 Path/to/File2.txt
100 path/to/file3.txt
101 x-outside-spec/file4.txt
103 git ls-files >actual &&
104 test_cmp expect actual
108 test_expect_success 'Clone root and ignore one file (ignorecase)' '
109 client_view \
110 "//depot/... //client/..." \
111 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
112 test_when_finished cleanup_git &&
114 cd "$git" &&
115 git init . &&
116 git config core.ignorecase true &&
117 git p4 clone --use-client-spec --destination="$git" //depot &&
118 # We ignore one file in the client spec and all path cases change from
119 # "TO" to "to"!
120 cat >expect <<-\EOF &&
121 Path/to/File2.txt
122 Path/to/file3.txt
123 x-outside-spec/file4.txt
125 git ls-files >actual &&
126 test_cmp expect actual
130 test_expect_success 'Clone path' '
131 client_view "//depot/Path/... //client/..." &&
132 test_when_finished cleanup_git &&
134 cd "$git" &&
135 git init . &&
136 git config core.ignorecase false &&
137 git p4 clone --use-client-spec --destination="$git" //depot &&
138 cat >expect <<-\EOF &&
139 to/File2.txt
141 git ls-files >actual &&
142 test_cmp expect actual
146 test_expect_success 'Clone path (ignorecase)' '
147 client_view "//depot/Path/... //client/..." &&
148 test_when_finished cleanup_git &&
150 cd "$git" &&
151 git init . &&
152 git config core.ignorecase true &&
153 git p4 clone --use-client-spec --destination="$git" //depot &&
154 cat >expect <<-\EOF &&
155 TO/File2.txt
156 TO/file1.txt
157 TO/file3.txt
159 git ls-files >actual &&
160 test_cmp expect actual
164 # It looks like P4 determines the path case based on the first file in
165 # lexicographical order. Please note the lower case "to" directory for all
166 # files triggered through the addition of "File0.txt".
167 test_expect_success 'Add a new file and clone path with new file (ignorecase)' '
168 client_view "//depot/... //client/..." &&
170 cd "$cli" &&
171 mkdir -p Path/to &&
172 >Path/to/File0.txt &&
173 p4 add Path/to/File0.txt &&
174 p4 submit -d "Add file" &&
175 rm -rf Path
176 ) &&
178 client_view "//depot/Path/... //client/..." &&
179 test_when_finished cleanup_git &&
181 cd "$git" &&
182 git init . &&
183 git config core.ignorecase true &&
184 git p4 clone --use-client-spec --destination="$git" //depot &&
185 cat >expect <<-\EOF &&
186 to/File0.txt
187 to/File2.txt
188 to/file1.txt
189 to/file3.txt
191 git ls-files >actual &&
192 test_cmp expect actual
196 test_expect_success 'kill p4d' '
197 kill_p4d
200 test_done