summaryrefslogtreecommitdiffstats
path: root/remote.h
diff options
context:
space:
mode:
authorXing Xin <xingxin.xx@bytedance.com>2024-10-08 05:38:16 +0200
committerJunio C Hamano <gitster@pobox.com>2024-10-08 19:22:07 +0200
commit72da5cfb1c81a1835a1f6bad5f19451baf9ad03c (patch)
treedbdfca3385b226efd95f1df1371f6f63c25daf2f /remote.h
parenttransport: introduce parse_transport_option() method (diff)
downloadgit-72da5cfb1c81a1835a1f6bad5f19451baf9ad03c.tar.xz
git-72da5cfb1c81a1835a1f6bad5f19451baf9ad03c.zip
remote: introduce remote.<name>.serverOption configuration
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.<name>.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.<name>.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 <ps@pks.im> Helped-by: Junio C Hamano <gitster@pobox.com> Reported-by: Liu Zhongbo <liuzhongbo.6666@bytedance.com> 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>
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/remote.h b/remote.h
index ad4513f639..a694681620 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;
};
/**