3 test_description='Clone repositories with path case variations'
7 test_expect_success 'start p4d with case folding enabled' '
11 test_expect_success 'Create a repo with path case variations' '
12 client_view "//depot/... //client/..." &&
18 p4 add Path/to/File2.txt &&
19 p4 submit -d "Add file2" &&
24 p4 add path/TO/file1.txt &&
25 p4 submit -d "Add file1" &&
30 p4 add path/to/file3.txt &&
31 p4 submit -d "Add file3" &&
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" &&
42 test_expect_success 'Clone root' '
43 client_view "//depot/... //client/..." &&
44 test_when_finished cleanup_git &&
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 &&
57 x-outside-spec/file4.txt
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 &&
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 &&
79 x-outside-spec/file4.txt
81 git ls-files >actual &&
82 test_cmp expect actual
86 test_expect_success 'Clone root and ignore one file' '
88 "//depot/... //client/..." \
89 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
90 test_when_finished cleanup_git &&
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
98 cat >expect <<-\EOF &&
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)' '
110 "//depot/... //client/..." \
111 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
112 test_when_finished cleanup_git &&
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
120 cat >expect <<-\EOF &&
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 &&
136 git config core.ignorecase false &&
137 git p4 clone --use-client-spec --destination="$git" //depot &&
138 cat >expect <<-\EOF &&
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 &&
152 git config core.ignorecase true &&
153 git p4 clone --use-client-spec --destination="$git" //depot &&
154 cat >expect <<-\EOF &&
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/..." &&
172 >Path/to/File0.txt &&
173 p4 add Path/to/File0.txt &&
174 p4 submit -d "Add file" &&
178 client_view "//depot/Path/... //client/..." &&
179 test_when_finished cleanup_git &&
183 git config core.ignorecase true &&
184 git p4 clone --use-client-spec --destination="$git" //depot &&
185 cat >expect <<-\EOF &&
191 git ls-files >actual &&
192 test_cmp expect actual