git p4 test: add broken --use-client-spec --detect-branches tests

Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Aug 11, 2012 at 12:55 UTC 19516356b29e964dcac3ed20b1eab5ff3cea7bee
1 file changed +77
t/t9801-git-p4-branch.sh
+77
@@ -410,6 +410,83 @@ test_expect_failure 'git p4 clone file subset branch' '
410 test_path_is_missing file3
411 )
412 '
413 +
414 +# From a report in http://stackoverflow.com/questions/11893688
415 +# where --use-client-spec caused branch prefixes not to be removed;
416 +# every file in git appeared into a subdirectory of the branch name.
417 +test_expect_success 'use-client-spec detect-branches setup' '
418 + rm -rf "$cli" &&
419 + mkdir "$cli" &&
420 + (
421 + cd "$cli" &&
422 + client_view "//depot/usecs/... //client/..." &&
423 + mkdir b1 &&
424 + echo b1/b1-file1 >b1/b1-file1 &&
425 + p4 add b1/b1-file1 &&
426 + p4 submit -d "b1/b1-file1" &&
427 +
428 + p4 integrate //depot/usecs/b1/... //depot/usecs/b2/... &&
429 + p4 submit -d "b1 -> b2" &&
430 + p4 branch -i <<-EOF &&
431 + Branch: b2
432 + View: //depot/usecs/b1/... //depot/usecs/b2/...
433 + EOF
434 +
435 + echo b2/b2-file2 >b2/b2-file2 &&
436 + p4 add b2/b2-file2 &&
437 + p4 submit -d "b2/b2-file2"
438 + )
439 +'
440 +
441 +test_expect_failure 'use-client-spec detect-branches files in top-level' '
442 + test_when_finished cleanup_git &&
443 + test_create_repo "$git" &&
444 + (
445 + cd "$git" &&
446 + git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
447 + git checkout -b master p4/usecs/b1 &&
448 + test_path_is_file b1-file1 &&
449 + test_path_is_missing b2-file2 &&
450 + test_path_is_missing b1 &&
451 + test_path_is_missing b2 &&
452 +
453 + git checkout -b b2 p4/usecs/b2 &&
454 + test_path_is_file b1-file1 &&
455 + test_path_is_file b2-file2 &&
456 + test_path_is_missing b1 &&
457 + test_path_is_missing b2
458 + )
459 +'
460 +
461 +test_expect_success 'use-client-spec detect-branches skips branches setup' '
462 + (
463 + cd "$cli" &&
464 +
465 + p4 integrate //depot/usecs/b1/... //depot/usecs/b3/... &&
466 + p4 submit -d "b1 -> b3" &&
467 + p4 branch -i <<-EOF &&
468 + Branch: b3
469 + View: //depot/usecs/b1/... //depot/usecs/b3/...
470 + EOF
471 +
472 + echo b3/b3-file3 >b3/b3-file3 &&
473 + p4 add b3/b3-file3 &&
474 + p4 submit -d "b3/b3-file3"
475 + )
476 +'
477 +
478 +test_expect_success 'use-client-spec detect-branches skips branches' '
479 + client_view "//depot/usecs/... //client/..." \
480 + "-//depot/usecs/b3/... //client/b3/..." &&
481 + test_when_finished cleanup_git &&
482 + test_create_repo "$git" &&
483 + (
484 + cd "$git" &&
485 + git p4 sync --detect-branches --use-client-spec //depot/usecs@all &&
486 + test_must_fail git rev-parse refs/remotes/p4/usecs/b3
487 + )
488 +'
489 +
490 test_expect_success 'kill p4d' '
491 kill_p4d
492 '