Skip to content

Commit 35d26e7

Browse files
jiangxingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 24f275a commit 35d26e7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

t/t5003-archive-zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ test_expect_success 'remote archive does not work with protocol v1' '
268268
'
269269

270270
test_expect_success 'archive remote http repository' '
271-
test_must_fail git archive --remote="$HTTPD_URL/auth/smart/bare.git" \
271+
git archive --remote="$HTTPD_URL/auth/smart/bare.git" \
272272
--output=remote-http.zip HEAD &&
273273
test_cmp_bin d.zip remote-http.zip
274274
'

transport-helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ static int connect_helper(struct transport *transport, const char *name,
669669

670670
fd[0] = data->helper->out;
671671
fd[1] = data->helper->in;
672+
673+
do_take_over(transport);
672674
return 0;
673675
}
674676

0 commit comments

Comments
 (0)