summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJiang Xin <zhiyou.jx@alibaba-inc.com>2024-01-21 13:15:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2024-01-22 15:54:37 (GMT)
commit35d26e79f8d8c030269a198d07de939bd3f5ea08 (patch)
treea670e2256d5ab0b69be60c785ff8b97bbaaa78eb /transport-helper.c
parent24f275ab33cd06f399a87a8384443e74da5f3545 (diff)
downloadgit-35d26e79f8d8c030269a198d07de939bd3f5ea08.zip
git-35d26e79f8d8c030269a198d07de939bd3f5ea08.tar.gz
git-35d26e79f8d8c030269a198d07de939bd3f5ea08.tar.bz2
transport-helper: call do_take_over() in connect_helper
After successfully connecting to the smart transport by calling process_connect_service() in connect_helper(), run do_take_over() to replace the old vtable with a new one which has methods ready for the smart transport connection. This fixes the exit code of git-archive in test case "archive remote http repository" of t5003. The connect_helper() function is used as the connect method of the vtable in "transport-helper.c", and it is called by transport_connect() in "transport.c" to setup a connection. The only place that we call transport_connect() so far is in "builtin/archive.c". Without running do_take_over(), it may fail to call transport_disconnect() in run_remote_archiver() of "builtin/archive.c". This is because for a stateless connection and a service like "git-upload-archive", the remote helper may receive a SIGPIPE signal and exit early. Call do_take_over() to have a graceful disconnect method, so that we still call transport_disconnect() even if the remote helper exits early. Helped-by: Linus Arver <linusa@google.com> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 6fe9f4f..91381be 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -669,6 +669,8 @@ static int connect_helper(struct transport *transport, const char *name,
fd[0] = data->helper->out;
fd[1] = data->helper->in;
+
+ do_take_over(transport);
return 0;
}