@matheusbsbs / matheus-bagliano / commits / d4785cd11d
Fork 0

t5516-fetch-push.sh: style cleanup

Cleanup t5516-fetch-push.sh to use prevailing test script style Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jay Soffian committed Apr 19, 2010 at 18:08 UTC d4785cd11dd0a55e30a1185a96910f0e57b6049a
1 file changed +46 -23
t/t5516-fetch-push.sh
+46 -23
@@ -64,13 +64,13 @@ check_push_result () {
64
65 test_expect_success setup '
66
67 - : >path1 &&
67 + >path1 &&
68 git add path1 &&
69 test_tick &&
70 git commit -a -m repo &&
71 the_first_commit=$(git show-ref -s --verify refs/heads/master) &&
72
73 - : >path2 &&
73 + >path2 &&
74 git add path2 &&
75 test_tick &&
76 git commit -a -m second &&
@@ -483,8 +483,10 @@ git config --remove-section remote.there
483 test_expect_success 'push with dry-run' '
484
485 mk_test heads/master &&
486 - (cd testrepo &&
487 - old_commit=$(git show-ref -s --verify refs/heads/master)) &&
486 + (
487 + cd testrepo &&
488 + old_commit=$(git show-ref -s --verify refs/heads/master)
489 + ) &&
490 git push --dry-run testrepo &&
491 check_push_result $old_commit heads/master
492 '
@@ -493,10 +495,13 @@ test_expect_success 'push updates local refs' '
495
496 mk_test heads/master &&
497 mk_child child &&
496 - (cd child &&
498 + (
499 + cd child &&
500 git pull .. master &&
501 git push &&
499 - test $(git rev-parse master) = $(git rev-parse remotes/origin/master))
502 + test $(git rev-parse master) = \
503 + $(git rev-parse remotes/origin/master)
504 + )
505
506 '
507
@@ -506,10 +511,13 @@ test_expect_success 'push updates up-to-date local refs' '
511 mk_child child1 &&
512 mk_child child2 &&
513 (cd child1 && git pull .. master && git push) &&
509 - (cd child2 &&
514 + (
515 + cd child2 &&
516 git pull ../child1 master &&
517 git push &&
512 - test $(git rev-parse master) = $(git rev-parse remotes/origin/master))
518 + test $(git rev-parse master) = \
519 + $(git rev-parse remotes/origin/master)
520 + )
521
522 '
523
@@ -517,9 +525,11 @@ test_expect_success 'push preserves up-to-date packed refs' '
525
526 mk_test heads/master &&
527 mk_child child &&
520 - (cd child &&
528 + (
529 + cd child &&
530 git push &&
522 - ! test -f .git/refs/remotes/origin/master)
531 + ! test -f .git/refs/remotes/origin/master
532 + )
533
534 '
535
@@ -530,11 +540,13 @@ test_expect_success 'push does not update local refs on failure' '
540 mkdir testrepo/.git/hooks &&
541 echo exit 1 >testrepo/.git/hooks/pre-receive &&
542 chmod +x testrepo/.git/hooks/pre-receive &&
533 - (cd child &&
543 + (
544 + cd child &&
545 git pull .. master
546 test_must_fail git push &&
547 test $(git rev-parse master) != \
537 - $(git rev-parse remotes/origin/master))
548 + $(git rev-parse remotes/origin/master)
549 + )
550
551 '
552
@@ -575,34 +587,41 @@ test_expect_success 'push --delete refuses src:dest refspecs' '
587
588 test_expect_success 'warn on push to HEAD of non-bare repository' '
589 mk_test heads/master
578 - (cd testrepo &&
590 + (
591 + cd testrepo &&
592 git checkout master &&
580 - git config receive.denyCurrentBranch warn) &&
593 + git config receive.denyCurrentBranch warn
594 + ) &&
595 git push testrepo master 2>stderr &&
596 grep "warning: updating the current branch" stderr
597 '
598
599 test_expect_success 'deny push to HEAD of non-bare repository' '
600 mk_test heads/master
587 - (cd testrepo &&
601 + (
602 + cd testrepo &&
603 git checkout master &&
589 - git config receive.denyCurrentBranch true) &&
604 + git config receive.denyCurrentBranch true
605 + ) &&
606 test_must_fail git push testrepo master
607 '
608
609 test_expect_success 'allow push to HEAD of bare repository (bare)' '
610 mk_test heads/master
595 - (cd testrepo &&
611 + (
612 + cd testrepo &&
613 git checkout master &&
614 git config receive.denyCurrentBranch true &&
598 - git config core.bare true) &&
615 + git config core.bare true
616 + ) &&
617 git push testrepo master 2>stderr &&
618 ! grep "warning: updating the current branch" stderr
619 '
620
621 test_expect_success 'allow push to HEAD of non-bare repository (config)' '
622 mk_test heads/master
605 - (cd testrepo &&
623 + (
624 + cd testrepo &&
625 git checkout master &&
626 git config receive.denyCurrentBranch false
627 ) &&
@@ -615,7 +634,8 @@ test_expect_success 'fetch with branches' '
634 git branch second $the_first_commit &&
635 git checkout second &&
636 echo ".." > testrepo/.git/branches/branch1 &&
618 - (cd testrepo &&
637 + (
638 + cd testrepo &&
639 git fetch branch1 &&
640 r=$(git show-ref -s --verify refs/heads/branch1) &&
641 test "z$r" = "z$the_commit" &&
@@ -627,7 +647,8 @@ test_expect_success 'fetch with branches' '
647 test_expect_success 'fetch with branches containing #' '
648 mk_empty &&
649 echo "..#second" > testrepo/.git/branches/branch2 &&
630 - (cd testrepo &&
650 + (
651 + cd testrepo &&
652 git fetch branch2 &&
653 r=$(git show-ref -s --verify refs/heads/branch2) &&
654 test "z$r" = "z$the_first_commit" &&
@@ -641,7 +662,8 @@ test_expect_success 'push with branches' '
662 git checkout second &&
663 echo "testrepo" > .git/branches/branch1 &&
664 git push branch1 &&
644 - (cd testrepo &&
665 + (
666 + cd testrepo &&
667 r=$(git show-ref -s --verify refs/heads/master) &&
668 test "z$r" = "z$the_first_commit" &&
669 test 1 = $(git for-each-ref refs/heads | wc -l)
@@ -652,7 +674,8 @@ test_expect_success 'push with branches containing #' '
674 mk_empty &&
675 echo "testrepo#branch3" > .git/branches/branch2 &&
676 git push branch2 &&
655 - (cd testrepo &&
677 + (
678 + cd testrepo &&
679 r=$(git show-ref -s --verify refs/heads/branch3) &&
680 test "z$r" = "z$the_first_commit" &&
681 test 1 = $(git for-each-ref refs/heads | wc -l)