aboutsummaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-18 15:30:32 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-18 15:30:32 -0800
commit345aaf3976a6abc491026c8a465b5e8ccbc8da5a (patch)
treeed05fb25aad1b568206963db3bbf10ee15affd3a /transport.c
parente565f3755342caf1d21e22359eaf09ec11d8c0ae (diff)
parentb81f8c8dd3ec81a8d622e2d3d6b2af426ca53f05 (diff)
downloadgit-345aaf3976a6abc491026c8a465b5e8ccbc8da5a.tar.xz
Merge branch 'ps/send-pack-unhide-error-in-atomic-push'
"git push --atomic --porcelain" used to ignore failures from the other side, losing the error status from the child process, which has been corrected. * ps/send-pack-unhide-error-in-atomic-push: send-pack: gracefully close the connection for atomic push t5543: atomic push reports exit code failure send-pack: new return code "ERROR_SEND_PACK_BAD_REF_STATUS" t5548: add porcelain push test cases for dry-run mode t5548: add new porcelain test cases t5548: refactor test cases by resetting upstream t5548: refactor to reuse setup_upstream() function t5504: modernize test by moving heredocs into test bodies
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/transport.c b/transport.c
index d6851dc475..6c2801bcbd 100644
--- a/transport.c
+++ b/transport.c
@@ -935,6 +935,13 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
case protocol_v0:
ret = send_pack(the_repository, &args, data->fd, data->conn, remote_refs,
&data->extra_have);
+ /*
+ * Ignore the specific error code to maintain consistent behavior
+ * with the "push_refs()" function across different transports,
+ * such as "push_refs_with_push()" for HTTP protocol.
+ */
+ if (ret == ERROR_SEND_PACK_BAD_REF_STATUS)
+ ret = 0;
break;
case protocol_unknown_version:
BUG("unknown protocol version");
@@ -942,15 +949,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
close(data->fd[1]);
close(data->fd[0]);
- /*
- * Atomic push may abort the connection early and close the pipe,
- * which may cause an error for `finish_connect()`. Ignore this error
- * for atomic git-push.
- */
- if (ret || args.atomic)
- finish_connect(data->conn);
- else
- ret = finish_connect(data->conn);
+ ret |= finish_connect(data->conn);
data->conn = NULL;
data->finished_handshake = 0;