From patchwork Tue Oct 8 03:38:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xing Xin X-Patchwork-Id: 13825605 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEC193BBDE for ; Tue, 8 Oct 2024 03:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358706; cv=none; b=RnOcX1Wo8GPT/qRuwDIMnfQy2Vdbt264kE1LShzkpD7J2ZX71WotL2VajEw3vxplyMI8nV/r0LAbJRFHXGrFUqYU1B/eoYm1au4pvF42R+K3pIycwnVoE/SEs/nZmhUFR0pslkBZe6c5yP0Ihft/8J484dyV/tqr0iGDogzWj+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358706; c=relaxed/simple; bh=/jvQD2FNHc+92kqEH6/bXe4BXMA8iDnvSDBxStXvHXw=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=pRXRNw1FcwDB9CzdLoE68TiQbNGNnUd02/AoaCnrO8U7/OTPOojYHvjJg+UP6QiykAnqo9HyWAWSbmcdeHJuCqJTdT+SO4nVp+Bv6sJNnLPS/BtSXo4GTitYw9VlPfAxKb8mc3MMDPTWm71mG1TZzAgzwXvRHIus+9BvHImmmfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O64Xkk4S; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O64Xkk4S" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-53997328633so6558902e87.3 for ; Mon, 07 Oct 2024 20:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728358702; x=1728963502; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=VsI6+m0lUHKGW2MyCFhSAENQsiTQQegTweIYYmCavzI=; b=O64Xkk4StsCOnnDFY3kKggaweGOZD8ONU7OVRgvMKbEmN8198Iy5akjZzzo6VlDkT4 sS0DUFS3LeStWtSykJjFrq7/d7JJLylxCPCk6Hnl2KFg51EDRgIF2jMw6Vlo/SoZ0d0R SSRGqy5pEXU2nY9f2FYNY/5h6pm5Y2phrx0gJ2XYy7UaU3WPV+yMK9YKT6dxpuXFSWwO Ycc3gjoD146eKEUG06d4uuMeziJ3g8f5BT6OTgcvs9zo039g8VA0sH002J8qKNzgUYfc yFu67E6A7MJ2acrw8ySkuOhod6HnKcdR79zqpz8wox7h5aZ8kZjS0X6V7Qo1ucPi2B3k zpjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728358702; x=1728963502; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VsI6+m0lUHKGW2MyCFhSAENQsiTQQegTweIYYmCavzI=; b=f9AYbCRryL86rLpT3M1fNP1kk89k+BY/IzpviPyTHhrk29plzOa/OCbGZnn2RPT/0F WTs9hxkYCWBIzYJma/COYvSbR5MqynAWHd7k2TYGe73KraN1KhlOmwGIkDu+7mxvxog9 X4IXWrzzuWrOdky0O8NmHR5y8T32Ey9gI/DwvHsr4fLs7uiumLCIcdvJgtbfC0ft5mxY DcSkRGkTOWeRjRdzV+ZZhhltwyE1LpEmrjGQ3B18A4U7sDPTACQkLssy1ZnczftLxm6Y wWdL8rB9+xYtr0ankqxcHFKIZLU8w6rSZ1I2u20kPGp6lZvsyVQ3SeMs9dD6ibjAn6mv +S6w== X-Gm-Message-State: AOJu0Yya/KC5nkqeBQuM0iEPY44Nkhy9LsjxPgw7sOTfjO7NllPu/EZo oBRC2O2qt36c9UNKAqUPN/KDYoqOvY2T2K86U2t5ZNb6IITSbeaUXBgaqw== X-Google-Smtp-Source: AGHT+IHZYnDzKU1iHEHqphL7xI0rzZxuP7CPo7St7tU0ICVA58DZ/BoX9H6Mr/t2DhnJmL/zMf8MPQ== X-Received: by 2002:a05:6512:3192:b0:533:483f:9562 with SMTP id 2adb3069b0e04-539ab9cf3c3mr8685637e87.42.1728358702007; Mon, 07 Oct 2024 20:38:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9953f118d8sm216327766b.81.2024.10.07.20.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 20:38:21 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Tue, 08 Oct 2024 03:38:15 +0000 Subject: [PATCH v3 1/5] transport: introduce parse_transport_option() method Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Brandon Williams , Jonathan Tan , Patrick Steinhardt , Liu Zhongbo , blanet , Xing Xin From: Xing Xin From: Xing Xin Add the `parse_transport_option()` method to parse the `push.pushOption` configuration. This method will also be used in the next commit to handle the new `remote..serverOption` configuration for setting server options in Git protocol v2. Signed-off-by: Xing Xin --- builtin/push.c | 9 +-------- transport.c | 12 ++++++++++++ transport.h | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index e6f48969b81..e0ff60d48e5 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -519,14 +519,7 @@ static int git_push_config(const char *k, const char *v, RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF; recurse_submodules = val; } else if (!strcmp(k, "push.pushoption")) { - if (!v) - return config_error_nonbool(k); - else - if (!*v) - string_list_clear(&push_options_config, 0); - else - string_list_append(&push_options_config, v); - return 0; + return parse_transport_option(k, v, &push_options_config); } else if (!strcmp(k, "color.push")) { push_use_color = git_config_colorbool(k, v); return 0; diff --git a/transport.c b/transport.c index 3c4714581f5..4d9e605b273 100644 --- a/transport.c +++ b/transport.c @@ -1099,6 +1099,18 @@ int is_transport_allowed(const char *type, int from_user) BUG("invalid protocol_allow_config type"); } +int parse_transport_option(const char *var, const char *value, + struct string_list *transport_options) +{ + if (!value) + return config_error_nonbool(var); + if (!*value) + string_list_clear(transport_options, 0); + else + string_list_append(transport_options, value); + return 0; +} + void transport_check_allowed(const char *type) { if (!is_transport_allowed(type, -1)) diff --git a/transport.h b/transport.h index 6393cd9823c..44100fa9b7f 100644 --- a/transport.h +++ b/transport.h @@ -342,4 +342,8 @@ void transport_print_push_status(const char *dest, struct ref *refs, /* common method used by transport-helper.c and send-pack.c */ void reject_atomic_push(struct ref *refs, int mirror_mode); +/* common method to parse push-option or server-option from config */ +int parse_transport_option(const char *var, const char *value, + struct string_list *transport_options); + #endif From patchwork Tue Oct 8 03:38:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xing Xin X-Patchwork-Id: 13825606 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4151A3EA6C for ; Tue, 8 Oct 2024 03:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358707; cv=none; b=FNBh3/5id9LKi1yX9viqStqrM6LhNM0b8SHEqgFPlXPVB9GIAcuC21y/Jun9Ngvc6MOx4+eI2pbEPpwFVjo65QachVVsxrQWPZnJk3gCkPFV/NQ1wVVGlehZl38f0Q7PVERHrf47eVqGJldKRIMUtmtR1rz24j/Ghh23EKsAUM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358707; c=relaxed/simple; bh=cGiORR69hHGT0c1b9tZjs8kDQ77GyoGfcdlq+8p6g1k=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=A1ldQFXvnK8fGv5hOhmCxU6otG2BPtDvtc6DU2ocooV4EdRN04RrcnYd+0oX+ICr5Px25dh/pzq4b/nTOWEErMlBiM2vm9y7u0PDJ+Is6n5wlX2RlH2t9DnPjOxLNh/AQQ35pkZrVgEeFbL+WB26tZFBSeQ+4RDSq31AjpiKm2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JNW2NFrR; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JNW2NFrR" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a993302fa02so334931266b.0 for ; Mon, 07 Oct 2024 20:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728358703; x=1728963503; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=WMac6SI0Imrgv4YKKCPn0nb4NksKecWrQs4fnkC0zNI=; b=JNW2NFrRNZdtnqeXYYZWrQBZJEu8gl0xLeeXLvcVWhPfD4CxmG79U8hx5PdsiZNcCK B0Re7hYOvmoAqMCfVeT6DCsmUnHXmtTL6MO46+adGeJEQVUp8aU5bo6E1J/3YcgC4BnB LClJVdtlcY7TBWtj6/rEKtShoMlhyRmrIzALb2YEw66Cf35RizE6ZgQUu82m8rR/dbLq 1VGXYs/JhVhCqOWuF6jPBn5XrLgcH0f2idCHSJQX/440LIC2VTfv9k6iVAci1t04CIOA PbQj7ruLV18u4aHMRQ48CyhYNPZCWg9fYOXQsjeGXMlJfGRsCVxhV07Nm6K9zh2fcY/m DgtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728358703; x=1728963503; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WMac6SI0Imrgv4YKKCPn0nb4NksKecWrQs4fnkC0zNI=; b=B4bb2u3Wng+VtJmEM7hvh+04H41If6eOqPQ/tdscOzTm0mPN+pCyZSGEmF2ZMPNW4F 2bIG31GNKb44G9BV+pN9LdIeOettSUpcWL4+95CtKx/mIK7Jb5dZ+la86AksgAxU1pRA Kk6d0i9Xt5T57RHe1azHZ61FnnKM0A71CI47NLzKWepEWb+TWvhUgeeA/VkYA6+yTMFD LfSpRRd6CXA952kG7deV1Dcbg6/Wj0Icx5sT3b1W5dYJzzlvz+2NVXkcwa8s/KnQXqfR fHvNRhFRgcQtTnS5viSkqmF6jkDfl+uOBeHk6pltiME0lTzGDl3WZOXl6ZGdVPXqLJuB thNw== X-Gm-Message-State: AOJu0Yx40SCY6zbbkxRxVoUw9xCIPkA2DiypGKlDSQaMwkzvswvCgNuN Skp7Rgp8smCU8/4X/SSRaRvsAnpOsoiWNlcDW0yT7D+nNEa48841adDXkA== X-Google-Smtp-Source: AGHT+IF8cHtSTshuYEJrO2n9ErxUzGsOzvfFsIWLDVHSzNPI69LYAnj9lsJo88SLoWAkoUdN4MWbpQ== X-Received: by 2002:a17:907:3daa:b0:a99:4654:caeb with SMTP id a640c23a62f3a-a994654ede6mr847248766b.35.1728358702718; Mon, 07 Oct 2024 20:38:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9963760779sm86712266b.204.2024.10.07.20.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 20:38:22 -0700 (PDT) Message-Id: <3c6b129d3689f1920c4f06220c74820822537076.1728358699.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 08 Oct 2024 03:38:16 +0000 Subject: [PATCH v3 2/5] remote: introduce remote..serverOption configuration Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Brandon Williams , Jonathan Tan , Patrick Steinhardt , Liu Zhongbo , blanet , Xing Xin From: Xing Xin From: Xing Xin Currently, server options for Git protocol v2 can only be specified via the command line option "--server-option" or "-o", which is inconvenient when users want to specify a list of default options to send. Therefore, we are introducing a new configuration to hold a list of default server options, akin to the `push.pushOption` configuration for push options. Initially, I named the new configuration `fetch.serverOption` to align with `push.pushOption`. However, after discussing with Patrick, it was renamed to `remote..serverOption` as suggested, because: 1. Server options are designed to be server-specific, making it more logical to use a per-remote configuration. 2. Using "fetch." prefixed configurations in git-clone or git-ls-remote seems out of place and inconsistent in design. The parsing logic for `remote..serverOption` also relies on `transport.c:parse_transport_option`, similar to `push.pushOption`, and they follow the same priority design: 1. Server options set in lower-priority configuration files (e.g., /etc/gitconfig or $HOME/.gitconfig) can be overridden or unset in more specific repository configurations using an empty string. 2. Command-line specified server options take precedence over those from the configuration. Server options from configuration are stored to the corresponding `remote.h:remote` as a new field `server_options`. The field will be utilized in the subsequent commit to help initialize the `server_options` of `transport.h:transport`. And documentation have been updated accordingly. Helped-by: Patrick Steinhardt Helped-by: Junio C Hamano Reported-by: Liu Zhongbo Signed-off-by: Xing Xin --- Documentation/config/remote.txt | 10 ++++++++++ remote.c | 6 ++++++ remote.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/Documentation/config/remote.txt b/Documentation/config/remote.txt index 36e771556c6..b194dff07b9 100644 --- a/Documentation/config/remote.txt +++ b/Documentation/config/remote.txt @@ -96,3 +96,13 @@ remote..partialclonefilter:: Changing or clearing this value will only affect fetches for new commits. To fetch associated objects for commits already present in the local object database, use the `--refetch` option of linkgit:git-fetch[1]. + +remote..serverOption:: + The default set of server options used when fetching from this remote. + These server options can be overridden by the `--server-option=` command + line arguments. ++ +This is a multi-valued variable, and an empty value can be used in a higher +priority configuration file (e.g. `.git/config` in a repository) to clear +the values inherited from a lower priority configuration files (e.g. +`$HOME/.gitconfig`). diff --git a/remote.c b/remote.c index 390a03c2643..fa65549aa44 100644 --- a/remote.c +++ b/remote.c @@ -24,6 +24,7 @@ #include "advice.h" #include "connect.h" #include "parse-options.h" +#include "transport.h" enum map_direction { FROM_SRC, FROM_DST }; @@ -143,6 +144,7 @@ static struct remote *make_remote(struct remote_state *remote_state, ret->name = xstrndup(name, len); refspec_init(&ret->push, REFSPEC_PUSH); refspec_init(&ret->fetch, REFSPEC_FETCH); + string_list_init_dup(&ret->server_options); ALLOC_GROW(remote_state->remotes, remote_state->remotes_nr + 1, remote_state->remotes_alloc); @@ -166,6 +168,7 @@ static void remote_clear(struct remote *remote) free((char *)remote->uploadpack); FREE_AND_NULL(remote->http_proxy); FREE_AND_NULL(remote->http_proxy_authmethod); + string_list_clear(&remote->server_options, 0); } static void add_merge(struct branch *branch, const char *name) @@ -508,6 +511,9 @@ static int handle_config(const char *key, const char *value, } else if (!strcmp(subkey, "vcs")) { FREE_AND_NULL(remote->foreign_vcs); return git_config_string(&remote->foreign_vcs, key, value); + } else if (!strcmp(subkey, "serveroption")) { + return parse_transport_option(key, value, + &remote->server_options); } return 0; } diff --git a/remote.h b/remote.h index a58713f20ad..e95d30946c0 100644 --- a/remote.h +++ b/remote.h @@ -4,6 +4,7 @@ #include "hash.h" #include "hashmap.h" #include "refspec.h" +#include "string-list.h" #include "strvec.h" struct option; @@ -104,6 +105,8 @@ struct remote { /* The method used for authenticating against `http_proxy`. */ char *http_proxy_authmethod; + + struct string_list server_options; }; /** From patchwork Tue Oct 8 03:38:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xing Xin X-Patchwork-Id: 13825607 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F18842ABE for ; Tue, 8 Oct 2024 03:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358708; cv=none; b=nuFhC/Rr6QG76TLC2EuwlgQEfAhlKnZ6mRi4TqlbjNdmjljN8lJIoD24QmhuSXDWyEwrSv/Bet9OhAWOwfIPxTjYozjw44Rp8gLMUeyeqCUpvyvJ1cE5/irAYb9Hz3tqdhVeGiGz/sFyHnp8MiXOM1mZjrallKOQLhSMkS1j9jQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728358708; c=relaxed/simple; bh=Rz/vK5uPmBZP+UYNuATM4PM7IXEU61ODpbFt0yViP6w=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=I83dQlso6Lporq5CEUQuWQuWXRGHdO2sdfLaubHTcXJmfbxcbev9W4t/AEkrHqubEAxB/M+ZcQvtitGnAHIWqO5a0unlStzsJ6BFmTZYqGWmTfzSHSsSqye05ugRP/oz7a+jCn/pYZ+KXvgPjXfRP4aMO/UsEct4w1zyWFlGHsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I8aJJ6q8; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I8aJJ6q8" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5c88b5c375fso6322897a12.3 for ; Mon, 07 Oct 2024 20:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728358704; x=1728963504; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=MGV5V522FCK2dLh6Pcq7jJpa3WeLc5JhyQxpM0hZSYI=; b=I8aJJ6q8P9s8URqr8uqMslJ1BHl7ZsPjalbFzTIvm89xT0kbawCo1exG4cbf2yBnXI vIKk0RbWBCrG/hKp18QUmAnH4DRz9Y6uvrtBdTIMtCL/Lo/ePk9DdlHuQhlOHzHtO8Ik 2RstjzsTK48SqROKENTZjDBUkAccvqT3Bh4afZMnW4Jv51op4E75XRHtjX3k/CP7QVV5 b//fbxqKFL2yM/Gv2YNTnmjJIDMpxehOnUYxhK05lfas73OA1qAp/WbcQBGitrmm1D0x FP1q5edI9c2IK0XFiAJQe4QL+sM3ednk2HH+IZY60J0TRXhzK/AX+WJIrusmh/Tj2uwf v14w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728358704; x=1728963504; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MGV5V522FCK2dLh6Pcq7jJpa3WeLc5JhyQxpM0hZSYI=; b=fnrWVvIY4fWnOF/gBc3KppBLlMhF86LsoRA5j9E+4PXwBCNvCe5IKXwCosfEXvIlMV QIYjSsC5D5kpIb3O0a1dLZ7W//C7nFlmZXcDtJc2V4H55zAgjj+LQ+uiYeYextqOJoVc wRaVifZ0AR0OBK6Cuk7KU7j8L+yMjPjJw786Dz0UN8K2bljcm2TiJ1TkmA2HzC3D+EPB VAGdAroTsjUPXnGpQ1DJglyb5O7ysZIgA2bls3YpDfWrUfePp+DyG3rsk6nh4usHmiBW oQ1QfkEHrE3RYtsQZ1me3TwmS4ldNZNEsyeP2dQXHmtiSakjDOwL2Dnd14Z04JgtQsjh zIKg== X-Gm-Message-State: AOJu0Yx1CXPyifmrSSHrq/a5nxknY0X27AQSYZhDG26EXEwLM7797LHM +ZdRkI5s+mQeeNMbe6ujDQ7FkWBQl8A5K1Y+32zkKNYa6U6fc9y3yKFHMg== X-Google-Smtp-Source: AGHT+IEyg7BhPyb4qp4Ni6Hw102sLFTRkQbVW/l1gEEjFDBBAwW6sSfBkc+J+y+V07OzhAQruEGGZA== X-Received: by 2002:a17:907:6093:b0:a99:4136:895f with SMTP id a640c23a62f3a-a99413696a0mr987427866b.41.1728358703625; Mon, 07 Oct 2024 20:38:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e5d0a32sm460037466b.19.2024.10.07.20.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 20:38:23 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Tue, 08 Oct 2024 03:38:17 +0000 Subject: [PATCH v3 3/5] transport.c::handshake: make use of server options from remote Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Brandon Williams , Jonathan Tan , Patrick Steinhardt , Liu Zhongbo , blanet , Xing Xin From: Xing Xin From: Xing Xin 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 --- Documentation/fetch-options.txt | 3 + Documentation/git-clone.txt | 3 + Documentation/git-ls-remote.txt | 3 + t/t5702-protocol-v2.sh | 123 ++++++++++++++++++++++++++++++++ transport.c | 3 + 5 files changed, 135 insertions(+) diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index 80838fe37ef..9dc7ac8dbdc 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -305,6 +305,9 @@ endif::git-pull[] unknown ones, is server-specific. When multiple `--server-option=