43ed1feedf6c523443d3bbab06ca8de02f756f03
1#!/bin/sh
2
3test_description='git p4 client view'
4
5. ./lib-git-p4.sh
6
7test_expect_success 'start p4d' '
8 start_p4d
9'
10
11#
12# Construct a client with this list of View lines
13#
14client_view() {
15 (
16 cat <<-EOF &&
17 Client: client
18 Description: client
19 Root: $cli
20 View:
21 EOF
22 for arg ; do
23 printf "\t$arg\n"
24 done
25 ) | p4 client -i
26}
27
28#
29# Verify these files exist, exactly. Caller creates
30# a list of files in file "files".
31#
32check_files_exist() {
33 ok=0 &&
34 num=$# &&
35 for arg ; do
36 test_path_is_file "$arg" &&
37 ok=$(($ok + 1))
38 done &&
39 test $ok -eq $num &&
40 test_line_count = $num files
41}
42
43#
44# Sync up the p4 client, make sure the given files (and only
45# those) exist.
46#
47client_verify() {
48 (
49 cd "$cli" &&
50 p4 sync &&
51 find . -type f ! -name files >files &&
52 check_files_exist "$@"
53 )
54}
55
56#
57# Make sure the named files, exactly, exist.
58#
59git_verify() {
60 (
61 cd "$git" &&
62 git ls-files >files &&
63 check_files_exist "$@"
64 )
65}
66
67# //depot
68# - dir1
69# - file11
70# - file12
71# - dir2
72# - file21
73# - file22
74init_depot() {
75 for d in 1 2 ; do
76 mkdir -p dir$d &&
77 for f in 1 2 ; do
78 echo dir$d/file$d$f >dir$d/file$d$f &&
79 p4 add dir$d/file$d$f &&
80 p4 submit -d "dir$d/file$d$f"
81 done
82 done &&
83 find . -type f ! -name files >files &&
84 check_files_exist dir1/file11 dir1/file12 \
85 dir2/file21 dir2/file22
86}
87
88test_expect_success 'init depot' '
89 (
90 cd "$cli" &&
91 init_depot
92 )
93'
94
95# double % for printf
96test_expect_success 'unsupported view wildcard %%n' '
97 client_view "//depot/%%%%1/sub/... //client/sub/%%%%1/..." &&
98 test_when_finished cleanup_git &&
99 test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
100'
101
102test_expect_success 'unsupported view wildcard *' '
103 client_view "//depot/*/bar/... //client/*/bar/..." &&
104 test_when_finished cleanup_git &&
105 test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
106'
107
108test_expect_success 'wildcard ... only supported at end of spec 1' '
109 client_view "//depot/.../file11 //client/.../file11" &&
110 test_when_finished cleanup_git &&
111 test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
112'
113
114test_expect_success 'wildcard ... only supported at end of spec 2' '
115 client_view "//depot/.../a/... //client/.../a/..." &&
116 test_when_finished cleanup_git &&
117 test_must_fail git p4 clone --use-client-spec --dest="$git" //depot
118'
119
120test_expect_success 'basic map' '
121 client_view "//depot/dir1/... //client/cli1/..." &&
122 files="cli1/file11 cli1/file12" &&
123 client_verify $files &&
124 test_when_finished cleanup_git &&
125 git p4 clone --use-client-spec --dest="$git" //depot &&
126 git_verify $files
127'
128
129test_expect_success 'client view with no mappings' '
130 client_view &&
131 client_verify &&
132 test_when_finished cleanup_git &&
133 git p4 clone --use-client-spec --dest="$git" //depot &&
134 git_verify
135'
136
137test_expect_success 'single file map' '
138 client_view "//depot/dir1/file11 //client/file11" &&
139 files="file11" &&
140 client_verify $files &&
141 test_when_finished cleanup_git &&
142 git p4 clone --use-client-spec --dest="$git" //depot &&
143 git_verify $files
144'
145
146test_expect_success 'later mapping takes precedence (entire repo)' '
147 client_view "//depot/dir1/... //client/cli1/..." \
148 "//depot/... //client/cli2/..." &&
149 files="cli2/dir1/file11 cli2/dir1/file12
150 cli2/dir2/file21 cli2/dir2/file22" &&
151 client_verify $files &&
152 test_when_finished cleanup_git &&
153 git p4 clone --use-client-spec --dest="$git" //depot &&
154 git_verify $files
155'
156
157test_expect_success 'later mapping takes precedence (partial repo)' '
158 client_view "//depot/dir1/... //client/..." \
159 "//depot/dir2/... //client/..." &&
160 files="file21 file22" &&
161 client_verify $files &&
162 test_when_finished cleanup_git &&
163 git p4 clone --use-client-spec --dest="$git" //depot &&
164 git_verify $files
165'
166
167# Reading the view backwards,
168# dir2 goes to cli12
169# dir1 cannot go to cli12 since it was filled by dir2
170# dir1 also does not go to cli3, since the second rule
171# noticed that it matched, but was already filled
172test_expect_success 'depot path matching rejected client path' '
173 client_view "//depot/dir1/... //client/cli3/..." \
174 "//depot/dir1/... //client/cli12/..." \
175 "//depot/dir2/... //client/cli12/..." &&
176 files="cli12/file21 cli12/file22" &&
177 client_verify $files &&
178 test_when_finished cleanup_git &&
179 git p4 clone --use-client-spec --dest="$git" //depot &&
180 git_verify $files
181'
182
183# since both have the same //client/..., the exclusion
184# rule keeps everything out
185test_expect_success 'exclusion wildcard, client rhs same (odd)' '
186 client_view "//depot/... //client/..." \
187 "-//depot/dir2/... //client/..." &&
188 client_verify &&
189 test_when_finished cleanup_git &&
190 git p4 clone --use-client-spec --dest="$git" //depot &&
191 git_verify
192'
193
194test_expect_success 'exclusion wildcard, client rhs different (normal)' '
195 client_view "//depot/... //client/..." \
196 "-//depot/dir2/... //client/dir2/..." &&
197 files="dir1/file11 dir1/file12" &&
198 client_verify $files &&
199 test_when_finished cleanup_git &&
200 git p4 clone --use-client-spec --dest="$git" //depot &&
201 git_verify $files
202'
203
204test_expect_success 'exclusion single file' '
205 client_view "//depot/... //client/..." \
206 "-//depot/dir2/file22 //client/file22" &&
207 files="dir1/file11 dir1/file12 dir2/file21" &&
208 client_verify $files &&
209 test_when_finished cleanup_git &&
210 git p4 clone --use-client-spec --dest="$git" //depot &&
211 git_verify $files
212'
213
214test_expect_success 'overlay wildcard' '
215 client_view "//depot/dir1/... //client/cli/..." \
216 "+//depot/dir2/... //client/cli/...\n" &&
217 files="cli/file11 cli/file12 cli/file21 cli/file22" &&
218 client_verify $files &&
219 test_when_finished cleanup_git &&
220 git p4 clone --use-client-spec --dest="$git" //depot &&
221 git_verify $files
222'
223
224test_expect_success 'overlay single file' '
225 client_view "//depot/dir1/... //client/cli/..." \
226 "+//depot/dir2/file21 //client/cli/file21" &&
227 files="cli/file11 cli/file12 cli/file21" &&
228 client_verify $files &&
229 test_when_finished cleanup_git &&
230 git p4 clone --use-client-spec --dest="$git" //depot &&
231 git_verify $files
232'
233
234test_expect_success 'exclusion with later inclusion' '
235 client_view "//depot/... //client/..." \
236 "-//depot/dir2/... //client/dir2/..." \
237 "//depot/dir2/... //client/dir2incl/..." &&
238 files="dir1/file11 dir1/file12 dir2incl/file21 dir2incl/file22" &&
239 client_verify $files &&
240 test_when_finished cleanup_git &&
241 git p4 clone --use-client-spec --dest="$git" //depot &&
242 git_verify $files
243'
244
245test_expect_success 'quotes on rhs only' '
246 client_view "//depot/dir1/... \"//client/cdir 1/...\"" &&
247 client_verify "cdir 1/file11" "cdir 1/file12" &&
248 test_when_finished cleanup_git &&
249 git p4 clone --use-client-spec --dest="$git" //depot &&
250 git_verify "cdir 1/file11" "cdir 1/file12"
251'
252
253#
254# Submit tests
255#
256
257# clone sets variable
258test_expect_success 'clone --use-client-spec sets useClientSpec' '
259 client_view "//depot/... //client/..." &&
260 test_when_finished cleanup_git &&
261 git p4 clone --use-client-spec --dest="$git" //depot &&
262 (
263 cd "$git" &&
264 git config --bool git-p4.useClientSpec >actual &&
265 echo true >true &&
266 test_cmp actual true
267 )
268'
269
270# clone just a subdir of the client spec
271test_expect_success 'subdir clone' '
272 client_view "//depot/... //client/..." &&
273 files="dir1/file11 dir1/file12 dir2/file21 dir2/file22" &&
274 client_verify $files &&
275 test_when_finished cleanup_git &&
276 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
277 git_verify dir1/file11 dir1/file12
278'
279
280#
281# submit back, see what happens: five cases
282#
283test_expect_success 'subdir clone, submit modify' '
284 client_view "//depot/... //client/..." &&
285 test_when_finished cleanup_git &&
286 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
287 (
288 cd "$git" &&
289 git config git-p4.skipSubmitEdit true &&
290 echo line >>dir1/file12 &&
291 git add dir1/file12 &&
292 git commit -m dir1/file12 &&
293 git p4 submit
294 ) &&
295 (
296 cd "$cli" &&
297 test_path_is_file dir1/file12 &&
298 test_line_count = 2 dir1/file12
299 )
300'
301
302test_expect_success 'subdir clone, submit add' '
303 client_view "//depot/... //client/..." &&
304 test_when_finished cleanup_git &&
305 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
306 (
307 cd "$git" &&
308 git config git-p4.skipSubmitEdit true &&
309 echo file13 >dir1/file13 &&
310 git add dir1/file13 &&
311 git commit -m dir1/file13 &&
312 git p4 submit
313 ) &&
314 (
315 cd "$cli" &&
316 test_path_is_file dir1/file13
317 )
318'
319
320test_expect_success 'subdir clone, submit delete' '
321 client_view "//depot/... //client/..." &&
322 test_when_finished cleanup_git &&
323 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
324 (
325 cd "$git" &&
326 git config git-p4.skipSubmitEdit true &&
327 git rm dir1/file12 &&
328 git commit -m "delete dir1/file12" &&
329 git p4 submit
330 ) &&
331 (
332 cd "$cli" &&
333 test_path_is_missing dir1/file12
334 )
335'
336
337test_expect_success 'subdir clone, submit copy' '
338 client_view "//depot/... //client/..." &&
339 test_when_finished cleanup_git &&
340 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
341 (
342 cd "$git" &&
343 git config git-p4.skipSubmitEdit true &&
344 git config git-p4.detectCopies true &&
345 cp dir1/file11 dir1/file11a &&
346 git add dir1/file11a &&
347 git commit -m "copy to dir1/file11a" &&
348 git p4 submit
349 ) &&
350 (
351 cd "$cli" &&
352 test_path_is_file dir1/file11a &&
353 test ! -w dir1/file11a
354 )
355'
356
357test_expect_success 'subdir clone, submit rename' '
358 client_view "//depot/... //client/..." &&
359 test_when_finished cleanup_git &&
360 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
361 (
362 cd "$git" &&
363 git config git-p4.skipSubmitEdit true &&
364 git config git-p4.detectRenames true &&
365 git mv dir1/file13 dir1/file13a &&
366 git commit -m "rename dir1/file13 to dir1/file13a" &&
367 git p4 submit
368 ) &&
369 (
370 cd "$cli" &&
371 test_path_is_missing dir1/file13 &&
372 test_path_is_file dir1/file13a &&
373 test ! -w dir1/file13a
374 )
375'
376
377test_expect_success 'reinit depot' '
378 (
379 cd "$cli" &&
380 rm files &&
381 p4 delete */* &&
382 p4 submit -d "delete all files" &&
383 init_depot
384 )
385'
386
387#
388# What happens when two files of the same name are overlayed together?
389# The last-listed file should take preference.
390#
391# //depot
392# - dir1
393# - file11
394# - file12
395# - filecollide
396# - dir2
397# - file21
398# - file22
399# - filecollide
400#
401test_expect_success 'overlay collision setup' '
402 client_view "//depot/... //client/..." &&
403 (
404 cd "$cli" &&
405 p4 sync &&
406 echo dir1/filecollide >dir1/filecollide &&
407 p4 add dir1/filecollide &&
408 p4 submit -d dir1/filecollide &&
409 echo dir2/filecollide >dir2/filecollide &&
410 p4 add dir2/filecollide &&
411 p4 submit -d dir2/filecollide
412 )
413'
414
415test_expect_success 'overlay collision 1 to 2' '
416 client_view "//depot/dir1/... //client/..." \
417 "+//depot/dir2/... //client/..." &&
418 files="file11 file12 file21 file22 filecollide" &&
419 echo dir2/filecollide >actual &&
420 client_verify $files &&
421 test_cmp actual "$cli"/filecollide &&
422 test_when_finished cleanup_git &&
423 git p4 clone --use-client-spec --dest="$git" //depot &&
424 git_verify $files &&
425 test_cmp actual "$git"/filecollide
426'
427
428test_expect_failure 'overlay collision 2 to 1' '
429 client_view "//depot/dir2/... //client/..." \
430 "+//depot/dir1/... //client/..." &&
431 files="file11 file12 file21 file22 filecollide" &&
432 echo dir1/filecollide >actual &&
433 client_verify $files &&
434 test_cmp actual "$cli"/filecollide &&
435 test_when_finished cleanup_git &&
436 git p4 clone --use-client-spec --dest="$git" //depot &&
437 git_verify $files &&
438 test_cmp actual "$git"/filecollide
439'
440
441test_expect_success 'overlay collision delete 2' '
442 client_view "//depot/... //client/..." &&
443 (
444 cd "$cli" &&
445 p4 sync &&
446 p4 delete dir2/filecollide &&
447 p4 submit -d "remove dir2/filecollide"
448 )
449'
450
451# no filecollide, got deleted with dir2
452test_expect_failure 'overlay collision 1 to 2, but 2 deleted' '
453 client_view "//depot/dir1/... //client/..." \
454 "+//depot/dir2/... //client/..." &&
455 files="file11 file12 file21 file22" &&
456 client_verify $files &&
457 test_when_finished cleanup_git &&
458 git p4 clone --use-client-spec --dest="$git" //depot &&
459 git_verify $files
460'
461
462test_expect_success 'overlay collision update 1' '
463 client_view "//depot/dir1/... //client/dir1/..." &&
464 (
465 cd "$cli" &&
466 p4 sync &&
467 p4 open dir1/filecollide &&
468 echo dir1/filecollide update >dir1/filecollide &&
469 p4 submit -d "update dir1/filecollide"
470 )
471'
472
473# still no filecollide, dir2 still wins with the deletion even though the
474# change to dir1 is more recent
475test_expect_failure 'overlay collision 1 to 2, but 2 deleted, then 1 updated' '
476 client_view "//depot/dir1/... //client/..." \
477 "+//depot/dir2/... //client/..." &&
478 files="file11 file12 file21 file22" &&
479 client_verify $files &&
480 test_when_finished cleanup_git &&
481 git p4 clone --use-client-spec --dest="$git" //depot &&
482 git_verify $files
483'
484
485test_expect_success 'overlay collision delete filecollides' '
486 client_view "//depot/... //client/..." &&
487 (
488 cd "$cli" &&
489 p4 sync &&
490 p4 delete dir1/filecollide dir2/filecollide &&
491 p4 submit -d "remove filecollides"
492 )
493'
494
495#
496# Overlays as part of sync, rather than initial checkout:
497# 1. add a file in dir1
498# 2. sync to include it
499# 3. add same file in dir2
500# 4. sync, make sure content switches as dir2 has priority
501# 5. add another file in dir1
502# 6. sync
503# 7. add/delete same file in dir2
504# 8. sync, make sure it disappears, again dir2 wins
505# 9. cleanup
506#
507# //depot
508# - dir1
509# - file11
510# - file12
511# - colA
512# - colB
513# - dir2
514# - file21
515# - file22
516# - colA
517# - colB
518#
519test_expect_success 'overlay sync: add colA in dir1' '
520 client_view "//depot/dir1/... //client/dir1/..." &&
521 (
522 cd "$cli" &&
523 p4 sync &&
524 echo dir1/colA >dir1/colA &&
525 p4 add dir1/colA &&
526 p4 submit -d dir1/colA
527 )
528'
529
530test_expect_success 'overlay sync: initial git checkout' '
531 client_view "//depot/dir1/... //client/..." \
532 "+//depot/dir2/... //client/..." &&
533 files="file11 file12 file21 file22 colA" &&
534 echo dir1/colA >actual &&
535 client_verify $files &&
536 test_cmp actual "$cli"/colA &&
537 git p4 clone --use-client-spec --dest="$git" //depot &&
538 git_verify $files &&
539 test_cmp actual "$git"/colA
540'
541
542test_expect_success 'overlay sync: add colA in dir2' '
543 client_view "//depot/dir2/... //client/dir2/..." &&
544 (
545 cd "$cli" &&
546 p4 sync &&
547 echo dir2/colA >dir2/colA &&
548 p4 add dir2/colA &&
549 p4 submit -d dir2/colA
550 )
551'
552
553test_expect_success 'overlay sync: colA content switch' '
554 client_view "//depot/dir1/... //client/..." \
555 "+//depot/dir2/... //client/..." &&
556 files="file11 file12 file21 file22 colA" &&
557 echo dir2/colA >actual &&
558 client_verify $files &&
559 test_cmp actual "$cli"/colA &&
560 (
561 cd "$git" &&
562 git p4 sync --use-client-spec &&
563 git merge --ff-only p4/master
564 ) &&
565 git_verify $files &&
566 test_cmp actual "$git"/colA
567'
568
569test_expect_success 'overlay sync: add colB in dir1' '
570 client_view "//depot/dir1/... //client/dir1/..." &&
571 (
572 cd "$cli" &&
573 p4 sync &&
574 echo dir1/colB >dir1/colB &&
575 p4 add dir1/colB &&
576 p4 submit -d dir1/colB
577 )
578'
579
580test_expect_success 'overlay sync: colB appears' '
581 client_view "//depot/dir1/... //client/..." \
582 "+//depot/dir2/... //client/..." &&
583 files="file11 file12 file21 file22 colA colB" &&
584 echo dir1/colB >actual &&
585 client_verify $files &&
586 test_cmp actual "$cli"/colB &&
587 (
588 cd "$git" &&
589 git p4 sync --use-client-spec &&
590 git merge --ff-only p4/master
591 ) &&
592 git_verify $files &&
593 test_cmp actual "$git"/colB
594'
595
596test_expect_success 'overlay sync: add/delete colB in dir2' '
597 client_view "//depot/dir2/... //client/dir2/..." &&
598 (
599 cd "$cli" &&
600 p4 sync &&
601 echo dir2/colB >dir2/colB &&
602 p4 add dir2/colB &&
603 p4 submit -d dir2/colB &&
604 p4 delete dir2/colB &&
605 p4 submit -d "delete dir2/colB"
606 )
607'
608
609test_expect_success 'overlay sync: colB disappears' '
610 client_view "//depot/dir1/... //client/..." \
611 "+//depot/dir2/... //client/..." &&
612 files="file11 file12 file21 file22 colA" &&
613 client_verify $files &&
614 test_when_finished cleanup_git &&
615 (
616 cd "$git" &&
617 git p4 sync --use-client-spec &&
618 git merge --ff-only p4/master
619 ) &&
620 git_verify $files
621'
622
623test_expect_success 'overlay sync: cleanup' '
624 client_view "//depot/... //client/..." &&
625 (
626 cd "$cli" &&
627 p4 sync &&
628 p4 delete dir1/colA dir2/colA dir1/colB &&
629 p4 submit -d "remove overlay sync files"
630 )
631'
632
633#
634# Overlay tests again, but swapped so dir1 has priority.
635# 1. add a file in dir1
636# 2. sync to include it
637# 3. add same file in dir2
638# 4. sync, make sure content does not switch
639# 5. add another file in dir1
640# 6. sync
641# 7. add/delete same file in dir2
642# 8. sync, make sure it is still there
643# 9. cleanup
644#
645# //depot
646# - dir1
647# - file11
648# - file12
649# - colA
650# - colB
651# - dir2
652# - file21
653# - file22
654# - colA
655# - colB
656#
657test_expect_success 'overlay sync swap: add colA in dir1' '
658 client_view "//depot/dir1/... //client/dir1/..." &&
659 (
660 cd "$cli" &&
661 p4 sync &&
662 echo dir1/colA >dir1/colA &&
663 p4 add dir1/colA &&
664 p4 submit -d dir1/colA
665 )
666'
667
668test_expect_success 'overlay sync swap: initial git checkout' '
669 client_view "//depot/dir2/... //client/..." \
670 "+//depot/dir1/... //client/..." &&
671 files="file11 file12 file21 file22 colA" &&
672 echo dir1/colA >actual &&
673 client_verify $files &&
674 test_cmp actual "$cli"/colA &&
675 git p4 clone --use-client-spec --dest="$git" //depot &&
676 git_verify $files &&
677 test_cmp actual "$git"/colA
678'
679
680test_expect_success 'overlay sync swap: add colA in dir2' '
681 client_view "//depot/dir2/... //client/dir2/..." &&
682 (
683 cd "$cli" &&
684 p4 sync &&
685 echo dir2/colA >dir2/colA &&
686 p4 add dir2/colA &&
687 p4 submit -d dir2/colA
688 )
689'
690
691test_expect_failure 'overlay sync swap: colA no content switch' '
692 client_view "//depot/dir2/... //client/..." \
693 "+//depot/dir1/... //client/..." &&
694 files="file11 file12 file21 file22 colA" &&
695 echo dir1/colA >actual &&
696 client_verify $files &&
697 test_cmp actual "$cli"/colA &&
698 (
699 cd "$git" &&
700 git p4 sync --use-client-spec &&
701 git merge --ff-only p4/master
702 ) &&
703 git_verify $files &&
704 test_cmp actual "$git"/colA
705'
706
707test_expect_success 'overlay sync swap: add colB in dir1' '
708 client_view "//depot/dir1/... //client/dir1/..." &&
709 (
710 cd "$cli" &&
711 p4 sync &&
712 echo dir1/colB >dir1/colB &&
713 p4 add dir1/colB &&
714 p4 submit -d dir1/colB
715 )
716'
717
718test_expect_success 'overlay sync swap: colB appears' '
719 client_view "//depot/dir2/... //client/..." \
720 "+//depot/dir1/... //client/..." &&
721 files="file11 file12 file21 file22 colA colB" &&
722 echo dir1/colB >actual &&
723 client_verify $files &&
724 test_cmp actual "$cli"/colB &&
725 (
726 cd "$git" &&
727 git p4 sync --use-client-spec &&
728 git merge --ff-only p4/master
729 ) &&
730 git_verify $files &&
731 test_cmp actual "$git"/colB
732'
733
734test_expect_success 'overlay sync swap: add/delete colB in dir2' '
735 client_view "//depot/dir2/... //client/dir2/..." &&
736 (
737 cd "$cli" &&
738 p4 sync &&
739 echo dir2/colB >dir2/colB &&
740 p4 add dir2/colB &&
741 p4 submit -d dir2/colB &&
742 p4 delete dir2/colB &&
743 p4 submit -d "delete dir2/colB"
744 )
745'
746
747test_expect_failure 'overlay sync swap: colB no change' '
748 client_view "//depot/dir2/... //client/..." \
749 "+//depot/dir1/... //client/..." &&
750 files="file11 file12 file21 file22 colA colB" &&
751 echo dir1/colB >actual &&
752 client_verify $files &&
753 test_cmp actual "$cli"/colB &&
754 test_when_finished cleanup_git &&
755 (
756 cd "$git" &&
757 git p4 sync --use-client-spec &&
758 git merge --ff-only p4/master
759 ) &&
760 git_verify $files &&
761 test_cmp actual "$cli"/colB
762'
763
764test_expect_success 'overlay sync swap: cleanup' '
765 client_view "//depot/... //client/..." &&
766 (
767 cd "$cli" &&
768 p4 sync &&
769 p4 delete dir1/colA dir2/colA dir1/colB &&
770 p4 submit -d "remove overlay sync files"
771 )
772'
773
774#
775# Rename directories to test quoting in depot-side mappings
776# //depot
777# - "dir 1"
778# - file11
779# - file12
780# - "dir 2"
781# - file21
782# - file22
783#
784test_expect_success 'rename files to introduce spaces' '
785 client_view "//depot/... //client/..." &&
786 client_verify dir1/file11 dir1/file12 \
787 dir2/file21 dir2/file22 &&
788 (
789 cd "$cli" &&
790 p4 open dir1/... &&
791 p4 move dir1/... "dir 1"/... &&
792 p4 open dir2/... &&
793 p4 move dir2/... "dir 2"/... &&
794 p4 submit -d "rename with spaces"
795 ) &&
796 client_verify "dir 1/file11" "dir 1/file12" \
797 "dir 2/file21" "dir 2/file22"
798'
799
800test_expect_success 'quotes on lhs only' '
801 client_view "\"//depot/dir 1/...\" //client/cdir1/..." &&
802 files="cdir1/file11 cdir1/file12" &&
803 client_verify $files &&
804 test_when_finished cleanup_git &&
805 git p4 clone --use-client-spec --dest="$git" //depot &&
806 client_verify $files
807'
808
809test_expect_success 'quotes on both sides' '
810 client_view "\"//depot/dir 1/...\" \"//client/cdir 1/...\"" &&
811 client_verify "cdir 1/file11" "cdir 1/file12" &&
812 test_when_finished cleanup_git &&
813 git p4 clone --use-client-spec --dest="$git" //depot &&
814 git_verify "cdir 1/file11" "cdir 1/file12"
815'
816
817test_expect_success 'kill p4d' '
818 kill_p4d
819'
820
821test_done