[PATCH v3 0/8] fix behaviors of git-push --porcelain
- From
Jiang Xin <worldhello.net@gmail.com>
- Date
- Dec 10, 2024, 11:36 UTC
- Message-ID
- <cover.1733830410.git.zhiyou.jx@alibaba-inc.com>
- In-Reply-To
- <cover.1731603991.git.zhiyou.jx@alibaba-inc.com>
From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
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.
# Changes since v2
* Split the changes made to t5548 into several commits for clarity.
* Correct the inconsistent return code of "push_refs()" across different transports to ensure that git push --porcelain behaves consistently.
* Gracefully close the connection for early exist of atomic push to resolve to root cause of wrong exit code of atomic git-push.
--
Jiang Xin (6): t5548: refactor to reuse setup_upstream() function t5548: refactor test cases by resetting upstream t5548: add new porcelain test cases t5548: add porcelain push test cases for dry-run mode send-pack: new return code "ERROR_SEND_PACK_BAD_REF_STATUS" send-pack: gracefully close the connection for atomic push
Patrick Steinhardt (2): t5504: modernize test by moving heredocs into test bodies t5543: atomic push reports exit code failure
send-pack.c | 10 +- send-pack.h | 3 + t/t5504-fetch-receive-strict.sh | 35 ++- t/t5543-atomic-push.sh | 30 +++ t/t5548-push-porcelain.sh | 425 +++++++++++++++++++++++--------- transport.c | 17 +- 6 files changed, 374 insertions(+), 146 deletions(-)
-- 2.47.0.rc1.21.g81e7bd6151