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