mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
transport.c:🤝 make use of server options from remote
Utilize the `server_options` from the corresponding remote during the handshake in `transport.c` when Git protocol v2 is detected. This helps initialize the `server_options` in `transport.h:transport` if no server options are set for the transport (typically via `--server-option` or `-o`). While another potential place to incorporate server options from the remote is in `transport.c:transport_get`, setting server options for a transport using a protocol other than v2 could lead to unexpected errors (see `transport.c:die_if_server_options`). Relevant tests and documentation have been updated accordingly. Signed-off-by: Xing Xin <xingxin.xx@bytedance.com> Reviewed-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -334,6 +334,9 @@ static struct ref *handshake(struct transport *transport, int for_push,
|
||||
data->version = discover_version(&reader);
|
||||
switch (data->version) {
|
||||
case protocol_v2:
|
||||
if ((!transport->server_options || !transport->server_options->nr) &&
|
||||
transport->remote->server_options.nr)
|
||||
transport->server_options = &transport->remote->server_options;
|
||||
if (server_feature_v2("session-id", &server_sid))
|
||||
trace2_data_string("transfer", NULL, "server-sid", server_sid);
|
||||
if (must_list_refs)
|
||||
|
||||
Reference in New Issue
Block a user