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