3 test_description
='Clone repositories with path case variations'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'start p4d with case folding enabled' '
12 test_expect_success
'Create a repo with path case variations' '
13 client_view "//depot/... //client/..." &&
19 p4 add Path/to/File2.txt &&
20 p4 submit -d "Add file2" &&
25 p4 add path/TO/file1.txt &&
26 p4 submit -d "Add file1" &&
31 p4 add path/to/file3.txt &&
32 p4 submit -d "Add file3" &&
35 mkdir -p x-outside-spec &&
36 >x-outside-spec/file4.txt &&
37 p4 add x-outside-spec/file4.txt &&
38 p4 submit -d "Add file4" &&
43 test_expect_success
'Clone root' '
44 client_view "//depot/... //client/..." &&
45 test_when_finished cleanup_git &&
49 git config core.ignorecase false &&
50 git p4 clone --use-client-spec --destination="$git" //depot &&
51 # This method is used instead of "test -f" to ensure the case is
52 # checked even if the test is executed on case-insensitive file systems.
53 # All files are there as expected although the path cases look random.
54 cat >expect <<-\EOF &&
58 x-outside-spec/file4.txt
60 git ls-files >actual &&
61 test_cmp expect actual
65 test_expect_success
'Clone root (ignorecase)' '
66 client_view "//depot/... //client/..." &&
67 test_when_finished cleanup_git &&
71 git config core.ignorecase true &&
72 git p4 clone --use-client-spec --destination="$git" //depot &&
73 # This method is used instead of "test -f" to ensure the case is
74 # checked even if the test is executed on case-insensitive file systems.
75 # All files are there as expected although the path cases look random.
76 cat >expect <<-\EOF &&
80 x-outside-spec/file4.txt
82 git ls-files >actual &&
83 test_cmp expect actual
87 test_expect_success
'Clone root and ignore one file' '
89 "//depot/... //client/..." \
90 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
91 test_when_finished cleanup_git &&
95 git config core.ignorecase false &&
96 git p4 clone --use-client-spec --destination="$git" //depot &&
97 # We ignore one file in the client spec and all path cases change from
99 cat >expect <<-\EOF &&
102 x-outside-spec/file4.txt
104 git ls-files >actual &&
105 test_cmp expect actual
109 test_expect_success
'Clone root and ignore one file (ignorecase)' '
111 "//depot/... //client/..." \
112 "-//depot/path/TO/file1.txt //client/path/TO/file1.txt" &&
113 test_when_finished cleanup_git &&
117 git config core.ignorecase true &&
118 git p4 clone --use-client-spec --destination="$git" //depot &&
119 # We ignore one file in the client spec and all path cases change from
121 cat >expect <<-\EOF &&
124 x-outside-spec/file4.txt
126 git ls-files >actual &&
127 test_cmp expect actual
131 test_expect_success
'Clone path' '
132 client_view "//depot/Path/... //client/..." &&
133 test_when_finished cleanup_git &&
137 git config core.ignorecase false &&
138 git p4 clone --use-client-spec --destination="$git" //depot &&
139 cat >expect <<-\EOF &&
142 git ls-files >actual &&
143 test_cmp expect actual
147 test_expect_success
'Clone path (ignorecase)' '
148 client_view "//depot/Path/... //client/..." &&
149 test_when_finished cleanup_git &&
153 git config core.ignorecase true &&
154 git p4 clone --use-client-spec --destination="$git" //depot &&
155 cat >expect <<-\EOF &&
160 git ls-files >actual &&
161 test_cmp expect actual
165 # It looks like P4 determines the path case based on the first file in
166 # lexicographical order. Please note the lower case "to" directory for all
167 # files triggered through the addition of "File0.txt".
168 test_expect_success
'Add a new file and clone path with new file (ignorecase)' '
169 client_view "//depot/... //client/..." &&
173 >Path/to/File0.txt &&
174 p4 add Path/to/File0.txt &&
175 p4 submit -d "Add file" &&
179 client_view "//depot/Path/... //client/..." &&
180 test_when_finished cleanup_git &&
184 git config core.ignorecase true &&
185 git p4 clone --use-client-spec --destination="$git" //depot &&
186 cat >expect <<-\EOF &&
192 git ls-files >actual &&
193 test_cmp expect actual