Message ID | 20211028183101.41013-2-chooglen@google.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | remote: replace static variables with struct remote_state | expand |
Glen Choo <chooglen@google.com> writes: > In detached HEAD, "git push remote-name" should push the refspecs in > remote.remote-name.push. Since there is no test case that checks this > behavior, add one. Makes sense. > > Signed-off-by: Glen Choo <chooglen@google.com> > --- > t/t5516-fetch-push.sh | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh > index 8212ca56dc..d4c2f1b68f 100755 > --- a/t/t5516-fetch-push.sh > +++ b/t/t5516-fetch-push.sh > @@ -541,6 +541,15 @@ do > > done > > +test_expect_success "push to remote with detached HEAD 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 &&
> In detached HEAD, "git push remote-name" should push the refspecs in > remote.remote-name.push. Since there is no test case that checks this > behavior, add one. This is technically true, but reading the documentation, it seems that this should also happen when we're not in detached HEAD. Maybe write: "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. The test itself looks OK.
Jonathan Tan <jonathantanmy@google.com> writes: > This is technically true, but reading the documentation, it seems that > this should also happen when we're not in detached HEAD. Maybe write: > > "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. Ah, you are right. I was under the wrong impression that refspec defaults to HEAD if HEAD points to a branch. I will adopt your wording, thanks.
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 8212ca56dc..d4c2f1b68f 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -541,6 +541,15 @@ do done +test_expect_success "push to remote with detached HEAD 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 &&
In detached HEAD, "git push remote-name" should push the refspecs in remote.remote-name.push. Since there is no test case that checks this behavior, add one. Signed-off-by: Glen Choo <chooglen@google.com> --- t/t5516-fetch-push.sh | 9 +++++++++ 1 file changed, 9 insertions(+)