]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5516: add test case for pushing remote refspecs
authorGlen Choo <chooglen@google.com>
Thu, 18 Nov 2021 00:53:21 +0000 (16:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Nov 2021 06:31:18 +0000 (22:31 -0800)
"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>
t/t5516-fetch-push.sh

index 8212ca56dc5b132edb552fba714657eed3579681..7831a38ddefdc52001b37c73f1087cda2462d182 100755 (executable)
@@ -541,6 +541,15 @@ do
 
 done
 
+test_expect_success "push to remote with no explicit refspec and config remote.*.push = src:dest" '
+       mk_test testrepo heads/main &&
+       git checkout $the_first_commit &&
+       test_config remote.there.url testrepo &&
+       test_config remote.there.push refs/heads/main:refs/heads/main &&
+       git push there &&
+       check_push_result testrepo $the_commit heads/main
+'
+
 test_expect_success 'push with remote.pushdefault' '
        mk_test up_repo heads/main &&
        mk_test down_repo heads/main &&