diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-02 21:57:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-03 00:06:13 +0200 |
commit | 4d8ee0317f01df5b6f3b41ed1bcb3dc6baecd464 (patch) | |
tree | efb4bfaf7dadab3c989ede13fb6faf1684323557 /t/t5516-fetch-push.sh | |
parent | Git 2.43.5 (diff) | |
download | git-4d8ee0317f01df5b6f3b41ed1bcb3dc6baecd464.tar.xz git-4d8ee0317f01df5b6f3b41ed1bcb3dc6baecd464.zip |
push: avoid showing false negotiation errors
When "git push" is configured to use the push negotiation, a push of
deletion of a branch (without pushing anything else) may end up not
having anything to negotiate for the common ancestor discovery.
In such a case, we end up making an internal invocation of "git
fetch --negotiate-only" without any "--negotiate-tip" parameters
that stops the negotiate-only fetch from being run, which by itself
is not a bad thing (one fewer round-trip), but the end-user sees a
"fatal: --negotiate-only needs one or more --negotiation-tip=*"
message that the user cannot act upon.
Teach "git push" to notice the situation and omit performing the
negotiate-only fetch to begin with. One fewer process spawned, one
fewer "alarming" message given the user.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-x | t/t5516-fetch-push.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 2e7c0e1648..9d693eb57f 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -230,6 +230,16 @@ test_expect_success 'push with negotiation proceeds anyway even if negotiation f test_grep "push negotiation failed" err ' +test_expect_success 'push deletion with negotiation' ' + mk_empty testrepo && + git push testrepo $the_first_commit:refs/heads/master && + git -c push.negotiate=1 push testrepo \ + :master $the_first_commit:refs/heads/next 2>errors-2 && + test_grep ! "negotiate-only needs one or " errors-2 && + git -c push.negotiate=1 push testrepo :next 2>errors-1 && + test_grep ! "negotiate-only needs one or " errors-1 +' + test_expect_success 'push with negotiation does not attempt to fetch submodules' ' mk_empty submodule_upstream && test_commit -C submodule_upstream submodule_commit && |