Skip to content

Commit 4a61faf

Browse files
jiangxingitster
authored andcommitted
transport-helper: no connection restriction in connect_helper
When commit b236752 (Support remote archive from all smart transports, 2009-12-09) added "remote archive" support for "smart transports", it was for transport that supports the ".connect" method. The "connect_helper()" function protected itself from getting called for a transport without the method before calling process_connect_service(), which only worked with the ".connect" method. Later, commit edc9caf (transport-helper: introduce stateless-connect, 2018-03-15) added a way for a transport without the ".connect" method to establish a "stateless" connection in protocol v2, where process_connect_service() was taught to handle the ".stateless_connect" method, making the old protection too strict. But commit edc9caf forgot to adjust this protection accordingly. Even at the time of commit b236752, this protection seemed redundant, since process_connect_service() would return 0 if the connection could not be established, and connect_helper() would still die() early. Remove the restriction in connect_helper() and give the function process_connect_service() the opportunity to establish a connection using ".connect" or ".stateless_connect" for protocol v2. So we can connect with a stateless-rpc and do something useful. E.g., in a later commit, implements remote archive for a repository over HTTP protocol. Helped-by: Junio C Hamano <[email protected]> Helped-by: Linus Arver <[email protected]> Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bcb6cae commit 4a61faf

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

transport-helper.c

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

663663
/* Get_helper so connect is inited. */
664664
get_helper(transport);
665-
if (!data->connect)
666-
die(_("operation not supported by protocol"));
667665

668666
if (!process_connect_service(transport, name, exec))
669667
die(_("can't connect to subservice %s"), name);

0 commit comments

Comments
 (0)