diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-07-18 23:34:33 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-18 23:35:54 +0200 |
commit | ae2c912c04cf9902653409d686ca6d5017c3906f (patch) | |
tree | 58403847c08a56733b7e261fbc8363184e3fa1de /parse-options.h | |
parent | Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.41 (diff) | |
download | git-ae2c912c04cf9902653409d686ca6d5017c3906f.tar.xz git-ae2c912c04cf9902653409d686ca6d5017c3906f.zip |
parse-options: introduce OPT_IPVERSION()
The command line option parsing for "git clone", "git fetch", and
"git push" have duplicated implementations of parsing "--ipv4" and
"--ipv6" options, by having two OPT_SET_INT() for "ipv4" and "ipv6".
Introduce a new OPT_IPVERSION() macro and use it in these three
commands.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h index 8e48efe524..e35710733d 100644 --- a/parse-options.h +++ b/parse-options.h @@ -581,4 +581,10 @@ int parse_opt_tracking_mode(const struct option *, const char *, int); #define OPT_PATHSPEC_FILE_NUL(v) OPT_BOOL(0, "pathspec-file-nul", v, N_("with --pathspec-from-file, pathspec elements are separated with NUL character")) #define OPT_AUTOSTASH(v) OPT_BOOL(0, "autostash", v, N_("automatically stash/stash pop before and after")) +#define OPT_IPVERSION(v) \ + OPT_SET_INT('4', "ipv4", (v), N_("use IPv4 addresses only"), \ + TRANSPORT_FAMILY_IPV4), \ + OPT_SET_INT('6', "ipv6", (v), N_("use IPv6 addresses only"), \ + TRANSPORT_FAMILY_IPV6) + #endif |