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 )
354'
355
356test_expect_success 'subdir clone, submit rename' '
357 client_view "//depot/... //client/..." &&
358 test_when_finished cleanup_git &&
359 git p4 clone --use-client-spec --dest="$git" //depot/dir1 &&
360 (
361 cd "$git" &&
362 git config git-p4.skipSubmitEdit true &&
363 git config git-p4.detectRenames true &&
364 git mv dir1/file13 dir1/file13a &&
365 git commit -m "rename dir1/file13 to dir1/file13a" &&
366 git p4 submit
367 ) &&
368 (
369 cd "$cli" &&
370 test_path_is_missing dir1/file13 &&
371 test_path_is_file dir1/file13a
372 )
373'
374
375test_expect_success 'reinit depot' '
376 (
377 cd "$cli" &&
378 p4 sync -f &&
379 rm files &&
380 p4 delete */* &&
381 p4 submit -d "delete all files" &&
382 init_depot
383 )
384'
385
386#
387# What happens when two files of the same name are overlayed together?
388# The last-listed file should take preference.
389#
390# //depot
391# - dir1
392# - file11
393# - file12
394# - filecollide
395# - dir2
396# - file21
397# - file22
398# - filecollide
399#
400test_expect_success 'overlay collision setup' '
401 client_view "//depot/... //client/..." &&
402 (
403 cd "$cli" &&
404 p4 sync &&
405 echo dir1/filecollide >dir1/filecollide &&
406 p4 add dir1/filecollide &&
407 p4 submit -d dir1/filecollide &&
408 echo dir2/filecollide >dir2/filecollide &&
409 p4 add dir2/filecollide &&
410 p4 submit -d dir2/filecollide
411 )
412'
413
414test_expect_success 'overlay collision 1 to 2' '
415 client_view "//depot/dir1/... //client/..." \
416 "+//depot/dir2/... //client/..." &&
417 files="file11 file12 file21 file22 filecollide" &&
418 echo dir2/filecollide >actual &&
419 client_verify $files &&
420 test_cmp actual "$cli"/filecollide &&
421 test_when_finished cleanup_git &&
422 git p4 clone --use-client-spec --dest="$git" //depot &&
423 git_verify $files &&
424 test_cmp actual "$git"/filecollide
425'
426
427test_expect_failure 'overlay collision 2 to 1' '
428 client_view "//depot/dir2/... //client/..." \
429 "+//depot/dir1/... //client/..." &&
430 files="file11 file12 file21 file22 filecollide" &&
431 echo dir1/filecollide >actual &&
432 client_verify $files &&
433 test_cmp actual "$cli"/filecollide &&
434 test_when_finished cleanup_git &&
435 git p4 clone --use-client-spec --dest="$git" //depot &&
436 git_verify $files &&
437 test_cmp actual "$git"/filecollide
438'
439
440test_expect_success 'overlay collision delete 2' '
441 client_view "//depot/... //client/..." &&
442 (
443 cd "$cli" &&
444 p4 sync &&
445 p4 delete dir2/filecollide &&
446 p4 submit -d "remove dir2/filecollide"
447 )
448'
449
450# no filecollide, got deleted with dir2
451test_expect_failure 'overlay collision 1 to 2, but 2 deleted' '
452 client_view "//depot/dir1/... //client/..." \
453 "+//depot/dir2/... //client/..." &&
454 files="file11 file12 file21 file22" &&
455 client_verify $files &&
456 test_when_finished cleanup_git &&
457 git p4 clone --use-client-spec --dest="$git" //depot &&
458 git_verify $files
459'
460
461test_expect_success 'overlay collision update 1' '
462 client_view "//depot/dir1/... //client/dir1/..." &&
463 (
464 cd "$cli" &&
465 p4 sync &&
466 p4 open dir1/filecollide &&
467 echo dir1/filecollide update >dir1/filecollide &&
468 p4 submit -d "update dir1/filecollide"
469 )
470'
471
472# still no filecollide, dir2 still wins with the deletion even though the
473# change to dir1 is more recent
474test_expect_failure 'overlay collision 1 to 2, but 2 deleted, then 1 updated' '
475 client_view "//depot/dir1/... //client/..." \
476 "+//depot/dir2/... //client/..." &&
477 files="file11 file12 file21 file22" &&
478 client_verify $files &&
479 test_when_finished cleanup_git &&
480 git p4 clone --use-client-spec --dest="$git" //depot &&
481 git_verify $files
482'
483
484test_expect_success 'overlay collision delete filecollides' '
485 client_view "//depot/... //client/..." &&
486 (
487 cd "$cli" &&
488 p4 sync &&
489 p4 delete dir1/filecollide dir2/filecollide &&
490 p4 submit -d "remove filecollides"
491 )
492'
493
494#
495# Overlays as part of sync, rather than initial checkout:
496# 1. add a file in dir1
497# 2. sync to include it
498# 3. add same file in dir2
499# 4. sync, make sure content switches as dir2 has priority
500# 5. add another file in dir1
501# 6. sync
502# 7. add/delete same file in dir2
503# 8. sync, make sure it disappears, again dir2 wins
504# 9. cleanup
505#
506# //depot
507# - dir1
508# - file11
509# - file12
510# - colA
511# - colB
512# - dir2
513# - file21
514# - file22
515# - colA
516# - colB
517#
518test_expect_success 'overlay sync: add colA in dir1' '
519 client_view "//depot/dir1/... //client/dir1/..." &&
520 (
521 cd "$cli" &&
522 p4 sync &&
523 echo dir1/colA >dir1/colA &&
524 p4 add dir1/colA &&
525 p4 submit -d dir1/colA
526 )
527'
528
529test_expect_success 'overlay sync: initial git checkout' '
530 client_view "//depot/dir1/... //client/..." \
531 "+//depot/dir2/... //client/..." &&
532 files="file11 file12 file21 file22 colA" &&
533 echo dir1/colA >actual &&
534 client_verify $files &&
535 test_cmp actual "$cli"/colA &&
536 git p4 clone --use-client-spec --dest="$git" //depot &&
537 git_verify $files &&
538 test_cmp actual "$git"/colA
539'
540
541test_expect_success 'overlay sync: add colA in dir2' '
542 client_view "//depot/dir2/... //client/dir2/..." &&
543 (
544 cd "$cli" &&
545 p4 sync &&
546 echo dir2/colA >dir2/colA &&
547 p4 add dir2/colA &&
548 p4 submit -d dir2/colA
549 )
550'
551
552test_expect_success 'overlay sync: colA content switch' '
553 client_view "//depot/dir1/... //client/..." \
554 "+//depot/dir2/... //client/..." &&
555 files="file11 file12 file21 file22 colA" &&
556 echo dir2/colA >actual &&
557 client_verify $files &&
558 test_cmp actual "$cli"/colA &&
559 (
560 cd "$git" &&
561 git p4 sync --use-client-spec &&
562 git merge --ff-only p4/master
563 ) &&
564 git_verify $files &&
565 test_cmp actual "$git"/colA
566'
567
568test_expect_success 'overlay sync: add colB in dir1' '
569 client_view "//depot/dir1/... //client/dir1/..." &&
570 (
571 cd "$cli" &&
572 p4 sync &&
573 echo dir1/colB >dir1/colB &&
574 p4 add dir1/colB &&
575 p4 submit -d dir1/colB
576 )
577'
578
579test_expect_success 'overlay sync: colB appears' '
580 client_view "//depot/dir1/... //client/..." \
581 "+//depot/dir2/... //client/..." &&
582 files="file11 file12 file21 file22 colA colB" &&
583 echo dir1/colB >actual &&
584 client_verify $files &&
585 test_cmp actual "$cli"/colB &&
586 (
587 cd "$git" &&
588 git p4 sync --use-client-spec &&
589 git merge --ff-only p4/master
590 ) &&
591 git_verify $files &&
592 test_cmp actual "$git"/colB
593'
594
595test_expect_success 'overlay sync: add/delete colB in dir2' '
596 client_view "//depot/dir2/... //client/dir2/..." &&
597 (
598 cd "$cli" &&
599 p4 sync &&
600 echo dir2/colB >dir2/colB &&
601 p4 add dir2/colB &&
602 p4 submit -d dir2/colB &&
603 p4 delete dir2/colB &&
604 p4 submit -d "delete dir2/colB"
605 )
606'
607
608test_expect_success 'overlay sync: colB disappears' '
609 client_view "//depot/dir1/... //client/..." \
610 "+//depot/dir2/... //client/..." &&
611 files="file11 file12 file21 file22 colA" &&
612 client_verify $files &&
613 test_when_finished cleanup_git &&
614 (
615 cd "$git" &&
616 git p4 sync --use-client-spec &&
617 git merge --ff-only p4/master
618 ) &&
619 git_verify $files
620'
621
622test_expect_success 'overlay sync: cleanup' '
623 client_view "//depot/... //client/..." &&
624 (
625 cd "$cli" &&
626 p4 sync &&
627 p4 delete dir1/colA dir2/colA dir1/colB &&
628 p4 submit -d "remove overlay sync files"
629 )
630'
631
632#
633# Overlay tests again, but swapped so dir1 has priority.
634# 1. add a file in dir1
635# 2. sync to include it
636# 3. add same file in dir2
637# 4. sync, make sure content does not switch
638# 5. add another file in dir1
639# 6. sync
640# 7. add/delete same file in dir2
641# 8. sync, make sure it is still there
642# 9. cleanup
643#
644# //depot
645# - dir1
646# - file11
647# - file12
648# - colA
649# - colB
650# - dir2
651# - file21
652# - file22
653# - colA
654# - colB
655#
656test_expect_success 'overlay sync swap: add colA in dir1' '
657 client_view "//depot/dir1/... //client/dir1/..." &&
658 (
659 cd "$cli" &&
660 p4 sync &&
661 echo dir1/colA >dir1/colA &&
662 p4 add dir1/colA &&
663 p4 submit -d dir1/colA
664 )
665'
666
667test_expect_success 'overlay sync swap: initial git checkout' '
668 client_view "//depot/dir2/... //client/..." \
669 "+//depot/dir1/... //client/..." &&
670 files="file11 file12 file21 file22 colA" &&
671 echo dir1/colA >actual &&
672 client_verify $files &&
673 test_cmp actual "$cli"/colA &&
674 git p4 clone --use-client-spec --dest="$git" //depot &&
675 git_verify $files &&
676 test_cmp actual "$git"/colA
677'
678
679test_expect_success 'overlay sync swap: add colA in dir2' '
680 client_view "//depot/dir2/... //client/dir2/..." &&
681 (
682 cd "$cli" &&
683 p4 sync &&
684 echo dir2/colA >dir2/colA &&
685 p4 add dir2/colA &&
686 p4 submit -d dir2/colA
687 )
688'
689
690test_expect_failure 'overlay sync swap: colA no content switch' '
691 client_view "//depot/dir2/... //client/..." \
692 "+//depot/dir1/... //client/..." &&
693 files="file11 file12 file21 file22 colA" &&
694 echo dir1/colA >actual &&
695 client_verify $files &&
696 test_cmp actual "$cli"/colA &&
697 (
698 cd "$git" &&
699 git p4 sync --use-client-spec &&
700 git merge --ff-only p4/master
701 ) &&
702 git_verify $files &&
703 test_cmp actual "$git"/colA
704'
705
706test_expect_success 'overlay sync swap: add colB in dir1' '
707 client_view "//depot/dir1/... //client/dir1/..." &&
708 (
709 cd "$cli" &&
710 p4 sync &&
711 echo dir1/colB >dir1/colB &&
712 p4 add dir1/colB &&
713 p4 submit -d dir1/colB
714 )
715'
716
717test_expect_success 'overlay sync swap: colB appears' '
718 client_view "//depot/dir2/... //client/..." \
719 "+//depot/dir1/... //client/..." &&
720 files="file11 file12 file21 file22 colA colB" &&
721 echo dir1/colB >actual &&
722 client_verify $files &&
723 test_cmp actual "$cli"/colB &&
724 (
725 cd "$git" &&
726 git p4 sync --use-client-spec &&
727 git merge --ff-only p4/master
728 ) &&
729 git_verify $files &&
730 test_cmp actual "$git"/colB
731'
732
733test_expect_success 'overlay sync swap: add/delete colB in dir2' '
734 client_view "//depot/dir2/... //client/dir2/..." &&
735 (
736 cd "$cli" &&
737 p4 sync &&
738 echo dir2/colB >dir2/colB &&
739 p4 add dir2/colB &&
740 p4 submit -d dir2/colB &&
741 p4 delete dir2/colB &&
742 p4 submit -d "delete dir2/colB"
743 )
744'
745
746test_expect_failure 'overlay sync swap: colB no change' '
747 client_view "//depot/dir2/... //client/..." \
748 "+//depot/dir1/... //client/..." &&
749 files="file11 file12 file21 file22 colA colB" &&
750 echo dir1/colB >actual &&
751 client_verify $files &&
752 test_cmp actual "$cli"/colB &&
753 test_when_finished cleanup_git &&
754 (
755 cd "$git" &&
756 git p4 sync --use-client-spec &&
757 git merge --ff-only p4/master
758 ) &&
759 git_verify $files &&
760 test_cmp actual "$cli"/colB
761'
762
763test_expect_success 'overlay sync swap: cleanup' '
764 client_view "//depot/... //client/..." &&
765 (
766 cd "$cli" &&
767 p4 sync &&
768 p4 delete dir1/colA dir2/colA dir1/colB &&
769 p4 submit -d "remove overlay sync files"
770 )
771'
772
773#
774# Rename directories to test quoting in depot-side mappings
775# //depot
776# - "dir 1"
777# - file11
778# - file12
779# - "dir 2"
780# - file21
781# - file22
782#
783test_expect_success 'rename files to introduce spaces' '
784 client_view "//depot/... //client/..." &&
785 client_verify dir1/file11 dir1/file12 \
786 dir2/file21 dir2/file22 &&
787 (
788 cd "$cli" &&
789 p4 open dir1/... &&
790 p4 move dir1/... "dir 1"/... &&
791 p4 open dir2/... &&
792 p4 move dir2/... "dir 2"/... &&
793 p4 submit -d "rename with spaces"
794 ) &&
795 client_verify "dir 1/file11" "dir 1/file12" \
796 "dir 2/file21" "dir 2/file22"
797'
798
799test_expect_success 'quotes on lhs only' '
800 client_view "\"//depot/dir 1/...\" //client/cdir1/..." &&
801 files="cdir1/file11 cdir1/file12" &&
802 client_verify $files &&
803 test_when_finished cleanup_git &&
804 git p4 clone --use-client-spec --dest="$git" //depot &&
805 client_verify $files
806'
807
808test_expect_success 'quotes on both sides' '
809 client_view "\"//depot/dir 1/...\" \"//client/cdir 1/...\"" &&
810 client_verify "cdir 1/file11" "cdir 1/file12" &&
811 test_when_finished cleanup_git &&
812 git p4 clone --use-client-spec --dest="$git" //depot &&
813 git_verify "cdir 1/file11" "cdir 1/file12"
814'
815
816test_expect_success 'kill p4d' '
817 kill_p4d
818'
819
820test_done