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

t5520: improve test style

Improve the test style by removing leading and trailing empty lines within test cases. Also, reformat multi-line subshells to conform to the existing style. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Nov 12, 2019 at 15:07 UTC e8d1eaf9b4b8cec4928962084d07147e0161a88e
1 file changed +45 -43
t/t5520-pull.sh
+45 -43
@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m
538 '
539
540 test_expect_success '--rebase with rebased upstream' '
541 -
541 git remote add -f me . &&
542 git checkout copy &&
543 git tag copy-orig &&
@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '
551 git pull --rebase me copy &&
552 test "conflicting modification" = "$(cat file)" &&
553 test file = "$(cat file2)"
555 -
554 '
555
556 test_expect_success '--rebase -f with rebased upstream' '
@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '
562 '
563
564 test_expect_success '--rebase with rebased default upstream' '
567 -
565 git update-ref refs/remotes/me/copy copy-orig &&
566 git checkout --track -b to-rebase2 me/copy &&
567 git reset --hard to-rebase-orig &&
568 git pull --rebase &&
569 test "conflicting modification" = "$(cat file)" &&
570 test file = "$(cat file2)"
574 -
571 '
572
573 test_expect_success 'rebased upstream + fetch + pull --rebase' '
@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '
584 '
585
586 test_expect_success 'pull --rebase dies early with dirty working directory' '
591 -
587 git checkout to-rebase &&
588 git update-ref refs/remotes/me/copy copy^ &&
589 COPY="$(git rev-parse --verify me/copy)" &&
@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
598 git checkout HEAD -- file &&
599 git pull &&
600 test "$COPY" != "$(git rev-parse --verify me/copy)"
606 -
601 '
602
603 test_expect_success 'pull --rebase works on branch yet to be born' '
604 git rev-parse master >expect &&
605 mkdir empty_repo &&
612 - (cd empty_repo &&
613 - git init &&
614 - git pull --rebase .. master &&
615 - git rev-parse HEAD >../actual
606 + (
607 + cd empty_repo &&
608 + git init &&
609 + git pull --rebase .. master &&
610 + git rev-parse HEAD >../actual
611 ) &&
612 test_cmp expect actual
613 '
@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '
641
642 test_expect_success 'setup for detecting upstreamed changes' '
643 mkdir src &&
649 - (cd src &&
650 - git init &&
651 - printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
652 - git add stuff &&
653 - git commit -m "Initial revision"
644 + (
645 + cd src &&
646 + git init &&
647 + printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
648 + git add stuff &&
649 + git commit -m "Initial revision"
650 ) &&
651 git clone src dst &&
656 - (cd src &&
657 - modify s/5/43/ stuff &&
658 - git commit -a -m "5->43" &&
659 - modify s/6/42/ stuff &&
660 - git commit -a -m "Make it bigger"
652 + (
653 + cd src &&
654 + modify s/5/43/ stuff &&
655 + git commit -a -m "5->43" &&
656 + modify s/6/42/ stuff &&
657 + git commit -a -m "Make it bigger"
658 ) &&
662 - (cd dst &&
663 - modify s/5/43/ stuff &&
664 - git commit -a -m "Independent discovery of 5->43"
659 + (
660 + cd dst &&
661 + modify s/5/43/ stuff &&
662 + git commit -a -m "Independent discovery of 5->43"
663 )
664 '
665
666 test_expect_success 'git pull --rebase detects upstreamed changes' '
669 - (cd dst &&
670 - git pull --rebase &&
671 - test -z "$(git ls-files -u)"
667 + (
668 + cd dst &&
669 + git pull --rebase &&
670 + test -z "$(git ls-files -u)"
671 )
672 '
673
674 test_expect_success 'setup for avoiding reapplying old patches' '
676 - (cd dst &&
677 - test_might_fail git rebase --abort &&
678 - git reset --hard origin/master
675 + (
676 + cd dst &&
677 + test_might_fail git rebase --abort &&
678 + git reset --hard origin/master
679 ) &&
680 git clone --bare src src-replace.git &&
681 rm -rf src &&
682 mv src-replace.git src &&
683 - (cd dst &&
684 - modify s/2/22/ stuff &&
685 - git commit -a -m "Change 2" &&
686 - modify s/3/33/ stuff &&
687 - git commit -a -m "Change 3" &&
688 - modify s/4/44/ stuff &&
689 - git commit -a -m "Change 4" &&
690 - git push &&
691 -
692 - modify s/44/55/ stuff &&
693 - git commit --amend -a -m "Modified Change 4"
683 + (
684 + cd dst &&
685 + modify s/2/22/ stuff &&
686 + git commit -a -m "Change 2" &&
687 + modify s/3/33/ stuff &&
688 + git commit -a -m "Change 3" &&
689 + modify s/4/44/ stuff &&
690 + git commit -a -m "Change 4" &&
691 + git push &&
692 +
693 + modify s/44/55/ stuff &&
694 + git commit --amend -a -m "Modified Change 4"
695 )
696 '
697
698 test_expect_success 'git pull --rebase does not reapply old patches' '
698 - (cd dst &&
699 - test_must_fail git pull --rebase &&
700 - test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
699 + (
700 + cd dst &&
701 + test_must_fail git pull --rebase &&
702 + test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
703 )
704 '
705