3 test_description
='git p4 wildcards'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'start p4d' '
12 test_expect_success
'add p4 files with wildcards in the names' '
15 printf "file2\nhas\nsome\nrandom\ntext\n" >file2 &&
17 echo file-wild-hash >file-wild#hash &&
18 if test_have_prereq !MINGW,!CYGWIN
20 echo file-wild-star >file-wild\*star
22 echo file-wild-at >file-wild@at &&
23 echo file-wild-percent >file-wild%percent &&
24 p4 add -f file-wild* &&
25 p4 submit -d "file wildcards"
29 test_expect_success
'wildcard files git p4 clone' '
30 git p4 clone --dest="$git" //depot &&
31 test_when_finished cleanup_git &&
34 test -f file-wild#hash &&
35 if test_have_prereq !MINGW,!CYGWIN
37 test -f file-wild\*star
39 test -f file-wild@at &&
40 test -f file-wild%percent
44 test_expect_success
'wildcard files submit back to p4, add' '
45 test_when_finished cleanup_git &&
46 git p4 clone --dest="$git" //depot &&
49 echo git-wild-hash >git-wild#hash &&
50 if test_have_prereq !MINGW,!CYGWIN
52 echo git-wild-star >git-wild\*star
54 echo git-wild-at >git-wild@at &&
55 echo git-wild-percent >git-wild%percent &&
57 git commit -m "add some wildcard filenames" &&
58 git config git-p4.skipSubmitEdit true &&
63 test_path_is_file git-wild#hash &&
64 if test_have_prereq !MINGW,!CYGWIN
66 test_path_is_file git-wild\*star
68 test_path_is_file git-wild@at &&
69 test_path_is_file git-wild%percent
73 test_expect_success
'wildcard files submit back to p4, modify' '
74 test_when_finished cleanup_git &&
75 git p4 clone --dest="$git" //depot &&
78 echo new-line >>git-wild#hash &&
79 if test_have_prereq !MINGW,!CYGWIN
81 echo new-line >>git-wild\*star
83 echo new-line >>git-wild@at &&
84 echo new-line >>git-wild%percent &&
86 git commit -m "modify the wildcard files" &&
87 git config git-p4.skipSubmitEdit true &&
92 test_line_count = 2 git-wild#hash &&
93 if test_have_prereq !MINGW,!CYGWIN
95 test_line_count = 2 git-wild\*star
97 test_line_count = 2 git-wild@at &&
98 test_line_count = 2 git-wild%percent
102 test_expect_success
'wildcard files submit back to p4, copy' '
103 test_when_finished cleanup_git &&
104 git p4 clone --dest="$git" //depot &&
107 cp file2 git-wild-cp#hash &&
108 git add git-wild-cp#hash &&
109 cp git-wild#hash file-wild-3 &&
110 git add file-wild-3 &&
111 git commit -m "wildcard copies" &&
112 git config git-p4.detectCopies true &&
113 git config git-p4.detectCopiesHarder true &&
114 git config git-p4.skipSubmitEdit true &&
119 test_path_is_file git-wild-cp#hash &&
120 test_path_is_file file-wild-3
124 test_expect_success
'wildcard files submit back to p4, rename' '
125 test_when_finished cleanup_git &&
126 git p4 clone --dest="$git" //depot &&
129 git mv git-wild@at file-wild-4 &&
130 git mv file-wild-3 git-wild-cp%percent &&
131 git commit -m "wildcard renames" &&
132 git config git-p4.detectRenames true &&
133 git config git-p4.skipSubmitEdit true &&
138 test_path_is_missing git-wild@at &&
139 test_path_is_file git-wild-cp%percent
143 test_expect_success
'wildcard files submit back to p4, delete' '
144 test_when_finished cleanup_git &&
145 git p4 clone --dest="$git" //depot &&
149 git commit -m "delete the wildcard files" &&
150 git config git-p4.skipSubmitEdit true &&
155 test_path_is_missing git-wild#hash &&
156 if test_have_prereq !MINGW,!CYGWIN
158 test_path_is_missing git-wild\*star
160 test_path_is_missing git-wild@at &&
161 test_path_is_missing git-wild%percent
165 test_expect_success
'p4 deleted a wildcard file' '
168 echo "wild delete test" >wild@delete &&
169 p4 add -f wild@delete &&
170 p4 submit -d "add wild@delete"
172 test_when_finished cleanup_git &&
173 git p4 clone --dest="$git" //depot &&
176 test_path_is_file wild@delete
180 # must use its encoded name
181 p4 delete wild%40delete &&
182 p4 submit -d "delete wild@delete"
187 git merge --ff-only p4/master &&
188 test_path_is_missing wild@delete
192 test_expect_success
'wildcard files requiring keyword scrub' '
195 cat <<-\EOF >scrub@wild &&
199 p4 add -t text+k -f scrub@wild &&
200 p4 submit -d "scrub at wild"
202 test_when_finished cleanup_git &&
203 git p4 clone --dest="$git" //depot &&
206 git config git-p4.skipSubmitEdit true &&
207 git config git-p4.attemptRCSCleanup true &&
208 sed "s/^line2/line2 edit/" <scrub@wild >scrub@wild.tmp &&
209 mv -f scrub@wild.tmp scrub@wild &&
210 git commit -m "scrub at wild line2 edit" scrub@wild &&