t5516: add test case for pushing remote refspecs

"git push remote-name" (that is, with no refspec given on the command line) should push the refspecs in remote.remote-name.push. There is no test case that checks this behavior in detached HEAD, so add one. Signed-off-by: Glen Choo <chooglen@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Glen Choo committed Nov 17, 2021 at 16:53 UTC e083ef5d54707a4bb855e8ac6f6ee0576a020349
1 file changed +9
t/t5516-fetch-push.sh
+9
@@ -541,6 +541,15 @@ do
541
542 done
543
544 +test_expect_success "push to remote with no explicit refspec and config remote.*.push = src:dest" '
545 + mk_test testrepo heads/main &&
546 + git checkout $the_first_commit &&
547 + test_config remote.there.url testrepo &&
548 + test_config remote.there.push refs/heads/main:refs/heads/main &&
549 + git push there &&
550 + check_push_result testrepo $the_commit heads/main
551 +'
552 +
553 test_expect_success 'push with remote.pushdefault' '
554 mk_test up_repo heads/main &&
555 mk_test down_repo heads/main &&