@@ -105,7 +105,6 @@ check_push_result () {
105105}
106106
107107test_expect_success setup '
108-
109108 >path1 &&
110109 git add path1 &&
111110 test_tick &&
@@ -117,7 +116,6 @@ test_expect_success setup '
117116 test_tick &&
118117 git commit -a -m second &&
119118 the_commit=$(git show-ref -s --verify refs/heads/main)
120-
121119'
122120
123121for cmd in push fetch
@@ -322,104 +320,82 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
322320'
323321
324322test_expect_success ' push with matching heads' '
325-
326323 mk_test testrepo heads/main &&
327324 git push testrepo : &&
328325 check_push_result testrepo $the_commit heads/main
329-
330326'
331327
332328test_expect_success ' push with matching heads on the command line' '
333-
334329 mk_test testrepo heads/main &&
335330 git push testrepo : &&
336331 check_push_result testrepo $the_commit heads/main
337-
338332'
339333
340334test_expect_success ' failed (non-fast-forward) push with matching heads' '
341-
342335 mk_test testrepo heads/main &&
343336 git push testrepo : &&
344337 git commit --amend -massaged &&
345338 test_must_fail git push testrepo &&
346339 check_push_result testrepo $the_commit heads/main &&
347340 git reset --hard $the_commit
348-
349341'
350342
351343test_expect_success ' push --force with matching heads' '
352-
353344 mk_test testrepo heads/main &&
354345 git push testrepo : &&
355346 git commit --amend -massaged &&
356347 git push --force testrepo : &&
357348 ! check_push_result testrepo $the_commit heads/main &&
358349 git reset --hard $the_commit
359-
360350'
361351
362352test_expect_success ' push with matching heads and forced update' '
363-
364353 mk_test testrepo heads/main &&
365354 git push testrepo : &&
366355 git commit --amend -massaged &&
367356 git push testrepo +: &&
368357 ! check_push_result testrepo $the_commit heads/main &&
369358 git reset --hard $the_commit
370-
371359'
372360
373361test_expect_success ' push with no ambiguity (1)' '
374-
375362 mk_test testrepo heads/main &&
376363 git push testrepo main:main &&
377364 check_push_result testrepo $the_commit heads/main
378-
379365'
380366
381367test_expect_success ' push with no ambiguity (2)' '
382-
383368 mk_test testrepo remotes/origin/main &&
384369 git push testrepo main:origin/main &&
385370 check_push_result testrepo $the_commit remotes/origin/main
386-
387371'
388372
389373test_expect_success ' push with colon-less refspec, no ambiguity' '
390-
391374 mk_test testrepo heads/main heads/t/main &&
392375 git branch -f t/main main &&
393376 git push testrepo main &&
394377 check_push_result testrepo $the_commit heads/main &&
395378 check_push_result testrepo $the_first_commit heads/t/main
396-
397379'
398380
399381test_expect_success ' push with weak ambiguity (1)' '
400-
401382 mk_test testrepo heads/main remotes/origin/main &&
402383 git push testrepo main:main &&
403384 check_push_result testrepo $the_commit heads/main &&
404385 check_push_result testrepo $the_first_commit remotes/origin/main
405-
406386'
407387
408388test_expect_success ' push with weak ambiguity (2)' '
409-
410389 mk_test testrepo heads/main remotes/origin/main remotes/another/main &&
411390 git push testrepo main:main &&
412391 check_push_result testrepo $the_commit heads/main &&
413392 check_push_result testrepo $the_first_commit remotes/origin/main remotes/another/main
414-
415393'
416394
417395test_expect_success ' push with ambiguity' '
418-
419396 mk_test testrepo heads/frotz tags/frotz &&
420397 test_must_fail git push testrepo main:frotz &&
421398 check_push_result testrepo $the_first_commit heads/frotz tags/frotz
422-
423399'
424400
425401test_expect_success ' push with onelevel ref' '
@@ -428,17 +404,14 @@ test_expect_success 'push with onelevel ref' '
428404'
429405
430406test_expect_success ' push with colon-less refspec (1)' '
431-
432407 mk_test testrepo heads/frotz tags/frotz &&
433408 git branch -f frotz main &&
434409 git push testrepo frotz &&
435410 check_push_result testrepo $the_commit heads/frotz &&
436411 check_push_result testrepo $the_first_commit tags/frotz
437-
438412'
439413
440414test_expect_success ' push with colon-less refspec (2)' '
441-
442415 mk_test testrepo heads/frotz tags/frotz &&
443416 if git show-ref --verify -q refs/heads/frotz
444417 then
@@ -448,7 +421,6 @@ test_expect_success 'push with colon-less refspec (2)' '
448421 git push -f testrepo frotz &&
449422 check_push_result testrepo $the_commit tags/frotz &&
450423 check_push_result testrepo $the_first_commit heads/frotz
451-
452424'
453425
454426test_expect_success ' push with colon-less refspec (3)' '
@@ -465,7 +437,6 @@ test_expect_success 'push with colon-less refspec (3)' '
465437'
466438
467439test_expect_success ' push with colon-less refspec (4)' '
468-
469440 mk_test testrepo &&
470441 if git show-ref --verify -q refs/heads/frotz
471442 then
@@ -475,38 +446,29 @@ test_expect_success 'push with colon-less refspec (4)' '
475446 git push testrepo frotz &&
476447 check_push_result testrepo $the_commit tags/frotz &&
477448 test 1 = $( cd testrepo && git show-ref | wc -l )
478-
479449'
480450
481451test_expect_success ' push head with non-existent, incomplete dest' '
482-
483452 mk_test testrepo &&
484453 git push testrepo main:branch &&
485454 check_push_result testrepo $the_commit heads/branch
486-
487455'
488456
489457test_expect_success ' push tag with non-existent, incomplete dest' '
490-
491458 mk_test testrepo &&
492459 git tag -f v1.0 &&
493460 git push testrepo v1.0:tag &&
494461 check_push_result testrepo $the_commit tags/tag
495-
496462'
497463
498464test_expect_success ' push oid with non-existent, incomplete dest' '
499-
500465 mk_test testrepo &&
501466 test_must_fail git push testrepo $(git rev-parse main):foo
502-
503467'
504468
505469test_expect_success ' push ref expression with non-existent, incomplete dest' '
506-
507470 mk_test testrepo &&
508471 test_must_fail git push testrepo main^:branch
509-
510472'
511473
512474for head in HEAD @
550512 git checkout main &&
551513 git push testrepo $head:branch &&
552514 check_push_result testrepo $the_commit heads/branch
553-
554515 '
555516
556517 test_expect_success " push with config remote.*.push = $head " '
@@ -596,7 +557,6 @@ test_expect_success 'push with remote.pushdefault' '
596557'
597558
598559test_expect_success ' push with config remote.*.pushurl' '
599-
600560 mk_test testrepo heads/main &&
601561 git checkout main &&
602562 test_config remote.there.url test2repo &&
@@ -655,15 +615,13 @@ test_expect_success 'push ignores "branch." config without subsection' '
655615'
656616
657617test_expect_success ' push with dry-run' '
658-
659618 mk_test testrepo heads/main &&
660619 old_commit=$(git -C testrepo show-ref -s --verify refs/heads/main) &&
661620 git push --dry-run testrepo : &&
662621 check_push_result testrepo $old_commit heads/main
663622'
664623
665624test_expect_success ' push updates local refs' '
666-
667625 mk_test testrepo heads/main &&
668626 mk_child testrepo child &&
669627 (
@@ -673,11 +631,9 @@ test_expect_success 'push updates local refs' '
673631 test $(git rev-parse main) = \
674632 $(git rev-parse remotes/origin/main)
675633 )
676-
677634'
678635
679636test_expect_success ' push updates up-to-date local refs' '
680-
681637 mk_test testrepo heads/main &&
682638 mk_child testrepo child1 &&
683639 mk_child testrepo child2 &&
@@ -689,23 +645,19 @@ test_expect_success 'push updates up-to-date local refs' '
689645 test $(git rev-parse main) = \
690646 $(git rev-parse remotes/origin/main)
691647 )
692-
693648'
694649
695650test_expect_success ' push preserves up-to-date packed refs' '
696-
697651 mk_test testrepo heads/main &&
698652 mk_child testrepo child &&
699653 (
700654 cd child &&
701655 git push &&
702656 ! test -f .git/refs/remotes/origin/main
703657 )
704-
705658'
706659
707660test_expect_success ' push does not update local refs on failure' '
708-
709661 mk_test testrepo heads/main &&
710662 mk_child testrepo child &&
711663 echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive &&
@@ -717,16 +669,13 @@ test_expect_success 'push does not update local refs on failure' '
717669 test $(git rev-parse main) != \
718670 $(git rev-parse remotes/origin/main)
719671 )
720-
721672'
722673
723674test_expect_success ' allow deleting an invalid remote ref' '
724-
725675 mk_test testrepo heads/branch &&
726676 rm -f testrepo/.git/objects/??/* &&
727677 git push testrepo :refs/heads/branch &&
728678 (cd testrepo && test_must_fail git rev-parse --verify refs/heads/branch)
729-
730679'
731680
732681test_expect_success ' pushing valid refs triggers post-receive and post-update hooks' '
0 commit comments