Skip to content

Commit d4785cd

Browse files
jaysoffiangitster
authored andcommitted
t5516-fetch-push.sh: style cleanup
Cleanup t5516-fetch-push.sh to use prevailing test script style Signed-off-by: Jay Soffian <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent da3efdb commit d4785cd

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

t/t5516-fetch-push.sh

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ check_push_result () {
6464

6565
test_expect_success setup '
6666
67-
: >path1 &&
67+
>path1 &&
6868
git add path1 &&
6969
test_tick &&
7070
git commit -a -m repo &&
7171
the_first_commit=$(git show-ref -s --verify refs/heads/master) &&
7272
73-
: >path2 &&
73+
>path2 &&
7474
git add path2 &&
7575
test_tick &&
7676
git commit -a -m second &&
@@ -483,8 +483,10 @@ git config --remove-section remote.there
483483
test_expect_success 'push with dry-run' '
484484
485485
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+
) &&
488490
git push --dry-run testrepo &&
489491
check_push_result $old_commit heads/master
490492
'
@@ -493,10 +495,13 @@ test_expect_success 'push updates local refs' '
493495
494496
mk_test heads/master &&
495497
mk_child child &&
496-
(cd child &&
498+
(
499+
cd child &&
497500
git pull .. master &&
498501
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+
)
500505
501506
'
502507

@@ -506,20 +511,25 @@ test_expect_success 'push updates up-to-date local refs' '
506511
mk_child child1 &&
507512
mk_child child2 &&
508513
(cd child1 && git pull .. master && git push) &&
509-
(cd child2 &&
514+
(
515+
cd child2 &&
510516
git pull ../child1 master &&
511517
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+
)
513521
514522
'
515523

516524
test_expect_success 'push preserves up-to-date packed refs' '
517525
518526
mk_test heads/master &&
519527
mk_child child &&
520-
(cd child &&
528+
(
529+
cd child &&
521530
git push &&
522-
! test -f .git/refs/remotes/origin/master)
531+
! test -f .git/refs/remotes/origin/master
532+
)
523533
524534
'
525535

@@ -530,11 +540,13 @@ test_expect_success 'push does not update local refs on failure' '
530540
mkdir testrepo/.git/hooks &&
531541
echo exit 1 >testrepo/.git/hooks/pre-receive &&
532542
chmod +x testrepo/.git/hooks/pre-receive &&
533-
(cd child &&
543+
(
544+
cd child &&
534545
git pull .. master
535546
test_must_fail git push &&
536547
test $(git rev-parse master) != \
537-
$(git rev-parse remotes/origin/master))
548+
$(git rev-parse remotes/origin/master)
549+
)
538550
539551
'
540552

@@ -575,34 +587,41 @@ test_expect_success 'push --delete refuses src:dest refspecs' '
575587

576588
test_expect_success 'warn on push to HEAD of non-bare repository' '
577589
mk_test heads/master
578-
(cd testrepo &&
590+
(
591+
cd testrepo &&
579592
git checkout master &&
580-
git config receive.denyCurrentBranch warn) &&
593+
git config receive.denyCurrentBranch warn
594+
) &&
581595
git push testrepo master 2>stderr &&
582596
grep "warning: updating the current branch" stderr
583597
'
584598

585599
test_expect_success 'deny push to HEAD of non-bare repository' '
586600
mk_test heads/master
587-
(cd testrepo &&
601+
(
602+
cd testrepo &&
588603
git checkout master &&
589-
git config receive.denyCurrentBranch true) &&
604+
git config receive.denyCurrentBranch true
605+
) &&
590606
test_must_fail git push testrepo master
591607
'
592608

593609
test_expect_success 'allow push to HEAD of bare repository (bare)' '
594610
mk_test heads/master
595-
(cd testrepo &&
611+
(
612+
cd testrepo &&
596613
git checkout master &&
597614
git config receive.denyCurrentBranch true &&
598-
git config core.bare true) &&
615+
git config core.bare true
616+
) &&
599617
git push testrepo master 2>stderr &&
600618
! grep "warning: updating the current branch" stderr
601619
'
602620

603621
test_expect_success 'allow push to HEAD of non-bare repository (config)' '
604622
mk_test heads/master
605-
(cd testrepo &&
623+
(
624+
cd testrepo &&
606625
git checkout master &&
607626
git config receive.denyCurrentBranch false
608627
) &&
@@ -615,7 +634,8 @@ test_expect_success 'fetch with branches' '
615634
git branch second $the_first_commit &&
616635
git checkout second &&
617636
echo ".." > testrepo/.git/branches/branch1 &&
618-
(cd testrepo &&
637+
(
638+
cd testrepo &&
619639
git fetch branch1 &&
620640
r=$(git show-ref -s --verify refs/heads/branch1) &&
621641
test "z$r" = "z$the_commit" &&
@@ -627,7 +647,8 @@ test_expect_success 'fetch with branches' '
627647
test_expect_success 'fetch with branches containing #' '
628648
mk_empty &&
629649
echo "..#second" > testrepo/.git/branches/branch2 &&
630-
(cd testrepo &&
650+
(
651+
cd testrepo &&
631652
git fetch branch2 &&
632653
r=$(git show-ref -s --verify refs/heads/branch2) &&
633654
test "z$r" = "z$the_first_commit" &&
@@ -641,7 +662,8 @@ test_expect_success 'push with branches' '
641662
git checkout second &&
642663
echo "testrepo" > .git/branches/branch1 &&
643664
git push branch1 &&
644-
(cd testrepo &&
665+
(
666+
cd testrepo &&
645667
r=$(git show-ref -s --verify refs/heads/master) &&
646668
test "z$r" = "z$the_first_commit" &&
647669
test 1 = $(git for-each-ref refs/heads | wc -l)
@@ -652,7 +674,8 @@ test_expect_success 'push with branches containing #' '
652674
mk_empty &&
653675
echo "testrepo#branch3" > .git/branches/branch2 &&
654676
git push branch2 &&
655-
(cd testrepo &&
677+
(
678+
cd testrepo &&
656679
r=$(git show-ref -s --verify refs/heads/branch3) &&
657680
test "z$r" = "z$the_first_commit" &&
658681
test 1 = $(git for-each-ref refs/heads | wc -l)

0 commit comments

Comments
 (0)