]> git.ipfire.org Git - thirdparty/git.git/commit
send-pack: gracefully close the connection for atomic push
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Mon, 3 Feb 2025 06:29:38 +0000 (07:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Feb 2025 23:24:58 +0000 (15:24 -0800)
commitb81f8c8dd3ec81a8d622e2d3d6b2af426ca53f05
tree756d9f9f158c11f81d63289462b004996e4305fa
parent60c208db584c5a1558acaef9c2ba2fdf15999bc9
send-pack: gracefully close the connection for atomic push

Patrick reported an issue that the exit code of git-receive-pack(1) is
ignored during atomic push with "--porcelain" flag, and added new test
cases in t5543.

This issue originated from commit 7dcbeaa0df (send-pack: fix
inconsistent porcelain output, 2020-04-17). At that time, I chose to
ignore the exit code of "finish_connect()" without investigating the
root cause of the abnormal termination of git-receive-pack. That was an
incorrect solution.

The root cause is that an atomic push operation terminates early without
sending a flush packet to git-receive-pack. As a result,
git-receive-pack continues waiting for commands without exiting. By
sending a flush packet at the appropriate location in "send_pack()", we
ensure that the git-receive-pack process closes properly, avoiding an
erroneous exit code for git-push. At the same time, revert the changes
to the "transport.c" file made in commit 7dcbeaa0df.

Reported-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
send-pack.c
t/t5543-atomic-push.sh
transport.c