From: Xing Xin via GitGitGadget Date: Mon, 23 Sep 2024 12:17:55 GMT Subject: [PATCH v2 2/5] remote: introduce remote..serverOption configuration Message-ID: <2474b4c69d68576e901cdd6381aac9410cf21922.1727093878.git.gitgitgadget@gmail.com> In-Reply-To: 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 | 7 +++++++ remote.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/Documentation/config/remote.txt b/Documentation/config/remote.txt index 8efc53e836d..8ba48573fb6 100644 --- a/Documentation/config/remote.txt +++ b/Documentation/config/remote.txt @@ -95,3 +95,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:: + When no `--server-option=