зеркало из https://github.com/microsoft/git.git
ssh: 'simple' variant does not support -4/-6
If the user passes -4/--ipv4 or -6/--ipv6 to "git fetch" or "git push" and the ssh command configured with GIT_SSH does not support such a setting, error out instead of ignoring the option and continuing. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
0da0e49ba1
Коммит
a3f5b66fac
25
connect.c
25
connect.c
|
@ -938,11 +938,30 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
|
||||||
get_protocol_version_config());
|
get_protocol_version_config());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant != VARIANT_SIMPLE) {
|
if (flags & CONNECT_IPV4) {
|
||||||
if (flags & CONNECT_IPV4)
|
switch (variant) {
|
||||||
|
case VARIANT_AUTO:
|
||||||
|
BUG("VARIANT_AUTO passed to push_ssh_options");
|
||||||
|
case VARIANT_SIMPLE:
|
||||||
|
die("ssh variant 'simple' does not support -4");
|
||||||
|
case VARIANT_SSH:
|
||||||
|
case VARIANT_PLINK:
|
||||||
|
case VARIANT_PUTTY:
|
||||||
|
case VARIANT_TORTOISEPLINK:
|
||||||
argv_array_push(args, "-4");
|
argv_array_push(args, "-4");
|
||||||
else if (flags & CONNECT_IPV6)
|
}
|
||||||
|
} else if (flags & CONNECT_IPV6) {
|
||||||
|
switch (variant) {
|
||||||
|
case VARIANT_AUTO:
|
||||||
|
BUG("VARIANT_AUTO passed to push_ssh_options");
|
||||||
|
case VARIANT_SIMPLE:
|
||||||
|
die("ssh variant 'simple' does not support -6");
|
||||||
|
case VARIANT_SSH:
|
||||||
|
case VARIANT_PLINK:
|
||||||
|
case VARIANT_PUTTY:
|
||||||
|
case VARIANT_TORTOISEPLINK:
|
||||||
argv_array_push(args, "-6");
|
argv_array_push(args, "-6");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant == VARIANT_TORTOISEPLINK)
|
if (variant == VARIANT_TORTOISEPLINK)
|
||||||
|
|
|
@ -364,9 +364,10 @@ test_expect_success 'OpenSSH variant passes -4' '
|
||||||
expect_ssh "-4 -p 123" myhost src
|
expect_ssh "-4 -p 123" myhost src
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'variant can be overriden' '
|
test_expect_success 'variant can be overridden' '
|
||||||
git -c ssh.variant=simple clone -4 "[myhost:123]:src" ssh-simple-clone &&
|
copy_ssh_wrapper_as "$TRASH_DIRECTORY/putty" &&
|
||||||
expect_ssh myhost src
|
git -c ssh.variant=putty clone -4 "[myhost:123]:src" ssh-putty-clone &&
|
||||||
|
expect_ssh "-4 -P 123" myhost src
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'variant=auto picks based on basename' '
|
test_expect_success 'variant=auto picks based on basename' '
|
||||||
|
@ -375,10 +376,9 @@ test_expect_success 'variant=auto picks based on basename' '
|
||||||
expect_ssh "-4 -P 123" myhost src
|
expect_ssh "-4 -P 123" myhost src
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'simple is treated as simple' '
|
test_expect_success 'simple does not support -4/-6' '
|
||||||
copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
|
copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
|
||||||
git clone -4 "[myhost:123]:src" ssh-bracket-clone-simple &&
|
test_must_fail git clone -4 "[myhost:123]:src" ssh-bracket-clone-simple
|
||||||
expect_ssh myhost src
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'uplink is treated as simple' '
|
test_expect_success 'uplink is treated as simple' '
|
||||||
|
|
Загрузка…
Ссылка в новой задаче