]> git.ipfire.org Git - thirdparty/git.git/commit
send-pack: fix push nego. when remote has refs
authorJonathan Tan <jonathantanmy@google.com>
Thu, 15 Jul 2021 17:44:31 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Jul 2021 18:58:52 +0000 (11:58 -0700)
commit54a03bc7d9a7f264d511d88166afe8da7f75e90a
treeb7482ea411f388965068f192886b94354d43aa64
parent74fab8ff54e6e6a30efa254b8b5322764d119386
send-pack: fix push nego. when remote has refs

Commit 477673d6f3 ("send-pack: support push negotiation", 2021-05-05)
did not test the case in which a remote advertises at least one ref. In
such a case, "remote_refs" in get_commons_through_negotiation() in
send-pack.c would also contain those refs with a zero ref->new_oid (in
addition to the refs being pushed with a nonzero ref->new_oid). Passing
them as negotiation tips to "git fetch" causes an error, so filter them
out.

(The exact error that would happen in "git fetch" in this case is a
segmentation fault, which is unwanted. This will be fixed in the
subsequent commit.)

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
send-pack.c
t/t5516-fetch-push.sh
t/t5549-fetch-push-http.sh