git p4: generate better error message for bad depot path
[git/jnareb-git.git] / t / t9812-git-p4-wildcards.sh
blob143d41305785090837bcd233cf67f0d57dfcff44
1 #!/bin/sh
3 test_description='git p4 wildcards'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 test_expect_success 'add p4 files with wildcards in the names' '
13 cd "$cli" &&
14 printf "file2\nhas\nsome\nrandom\ntext\n" >file2 &&
15 p4 add file2 &&
16 echo file-wild-hash >file-wild#hash &&
17 echo file-wild-star >file-wild\*star &&
18 echo file-wild-at >file-wild@at &&
19 echo file-wild-percent >file-wild%percent &&
20 p4 add -f file-wild* &&
21 p4 submit -d "file wildcards"
25 test_expect_success 'wildcard files git p4 clone' '
26 git p4 clone --dest="$git" //depot &&
27 test_when_finished cleanup_git &&
29 cd "$git" &&
30 test -f file-wild#hash &&
31 test -f file-wild\*star &&
32 test -f file-wild@at &&
33 test -f file-wild%percent
37 test_expect_success 'wildcard files submit back to p4, add' '
38 test_when_finished cleanup_git &&
39 git p4 clone --dest="$git" //depot &&
41 cd "$git" &&
42 echo git-wild-hash >git-wild#hash &&
43 echo git-wild-star >git-wild\*star &&
44 echo git-wild-at >git-wild@at &&
45 echo git-wild-percent >git-wild%percent &&
46 git add git-wild* &&
47 git commit -m "add some wildcard filenames" &&
48 git config git-p4.skipSubmitEdit true &&
49 git p4 submit
50 ) &&
52 cd "$cli" &&
53 test_path_is_file git-wild#hash &&
54 test_path_is_file git-wild\*star &&
55 test_path_is_file git-wild@at &&
56 test_path_is_file git-wild%percent
60 test_expect_success 'wildcard files submit back to p4, modify' '
61 test_when_finished cleanup_git &&
62 git p4 clone --dest="$git" //depot &&
64 cd "$git" &&
65 echo new-line >>git-wild#hash &&
66 echo new-line >>git-wild\*star &&
67 echo new-line >>git-wild@at &&
68 echo new-line >>git-wild%percent &&
69 git add git-wild* &&
70 git commit -m "modify the wildcard files" &&
71 git config git-p4.skipSubmitEdit true &&
72 git p4 submit
73 ) &&
75 cd "$cli" &&
76 test_line_count = 2 git-wild#hash &&
77 test_line_count = 2 git-wild\*star &&
78 test_line_count = 2 git-wild@at &&
79 test_line_count = 2 git-wild%percent
83 test_expect_success 'wildcard files submit back to p4, copy' '
84 test_when_finished cleanup_git &&
85 git p4 clone --dest="$git" //depot &&
87 cd "$git" &&
88 cp file2 git-wild-cp#hash &&
89 git add git-wild-cp#hash &&
90 cp git-wild\*star file-wild-3 &&
91 git add file-wild-3 &&
92 git commit -m "wildcard copies" &&
93 git config git-p4.detectCopies true &&
94 git config git-p4.detectCopiesHarder true &&
95 git config git-p4.skipSubmitEdit true &&
96 git p4 submit
97 ) &&
99 cd "$cli" &&
100 test_path_is_file git-wild-cp#hash &&
101 test_path_is_file file-wild-3
105 test_expect_success 'wildcard files submit back to p4, rename' '
106 test_when_finished cleanup_git &&
107 git p4 clone --dest="$git" //depot &&
109 cd "$git" &&
110 git mv git-wild@at file-wild-4 &&
111 git mv file-wild-3 git-wild-cp%percent &&
112 git commit -m "wildcard renames" &&
113 git config git-p4.detectRenames true &&
114 git config git-p4.skipSubmitEdit true &&
115 git p4 submit
116 ) &&
118 cd "$cli" &&
119 test_path_is_missing git-wild@at &&
120 test_path_is_file git-wild-cp%percent
124 test_expect_success 'wildcard files submit back to p4, delete' '
125 test_when_finished cleanup_git &&
126 git p4 clone --dest="$git" //depot &&
128 cd "$git" &&
129 git rm git-wild* &&
130 git commit -m "delete the wildcard files" &&
131 git config git-p4.skipSubmitEdit true &&
132 git p4 submit
133 ) &&
135 cd "$cli" &&
136 test_path_is_missing git-wild#hash &&
137 test_path_is_missing git-wild\*star &&
138 test_path_is_missing git-wild@at &&
139 test_path_is_missing git-wild%percent
143 test_expect_success 'kill p4d' '
144 kill_p4d
147 test_done