connect & http: support -4 and -6 switches for remote operations
Sometimes it is necessary to force IPv4-only or IPv6-only operation on networks where name lookups may return a non-routable address and stall remote operations. The ssh(1) command has an equivalent switches which we may pass when we run them. There may be old ssh(1) implementations out there which do not support these switches; they should report the appropriate error in that case. rsync support is untouched for now since it is deprecated and scheduled to be removed. Signed-off-by: Eric Wong <normalperson@yhbt.net> Reviewed-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f3ee9ca53b
commit
c915f11eb4
@ -47,6 +47,7 @@ static const char *real_git_dir;
|
||||
static char *option_upload_pack = "git-upload-pack";
|
||||
static int option_verbosity;
|
||||
static int option_progress = -1;
|
||||
static enum transport_family family;
|
||||
static struct string_list option_config;
|
||||
static struct string_list option_reference;
|
||||
static int option_dissociate;
|
||||
@ -92,6 +93,10 @@ static struct option builtin_clone_options[] = {
|
||||
N_("separate git dir from working tree")),
|
||||
OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
|
||||
N_("set config inside the new repository")),
|
||||
OPT_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"),
|
||||
TRANSPORT_FAMILY_IPV4),
|
||||
OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
|
||||
TRANSPORT_FAMILY_IPV6),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
@ -967,6 +972,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||
remote = remote_get(option_origin);
|
||||
transport = transport_get(remote, remote->url[0]);
|
||||
transport_set_verbosity(transport, option_verbosity, option_progress);
|
||||
transport->family = family;
|
||||
|
||||
path = get_repo_path(remote->url[0], &is_bundle);
|
||||
is_local = option_local != 0 && path && !is_bundle;
|
||||
|
||||
Reference in New Issue
Block a user