summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2017-11-20 13:31:01 -0800
committerJunio C Hamano <gitster@pobox.com>2017-11-21 14:01:03 +0900
commit3fa5e0d07a979dfd1a1095a9dda4904c62189e00 (patch)
treec76b4807066e4268f1ff0ced5e2f9deb8b76b73a /connect.c
parenta3f5b66fac3b5f3b2c352c8086dbc3d476f9e3d4 (diff)
downloadgit-3fa5e0d07a979dfd1a1095a9dda4904c62189e00.tar.gz
ssh: 'simple' variant does not support --port
When trying to connect to an ssh:// URL with port explicitly specified and the ssh command configured with GIT_SSH does not support such a setting, it is less confusing to error out than to silently suppress the port setting and continue. This requires updating the GIT_SSH setting in t5603-clone-dirname.sh. That test is about the directory name produced when cloning various URLs. It uses an ssh wrapper that ignores all its arguments but does not declare that it supports a port argument; update it to set GIT_SSH_VARIANT=ssh to do so. (Real-life ssh wrappers that pass a port argument to OpenSSH would also support -G and would not require such an update.) Reported-by: William Yan <wyan@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/connect.c b/connect.c
index c3d1cd3787..d6033861b3 100644
--- a/connect.c
+++ b/connect.c
@@ -967,11 +967,20 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
if (variant == VARIANT_TORTOISEPLINK)
argv_array_push(args, "-batch");
- if (port && variant != VARIANT_SIMPLE) {
- if (variant == VARIANT_SSH)
+ if (port) {
+ switch (variant) {
+ case VARIANT_AUTO:
+ BUG("VARIANT_AUTO passed to push_ssh_options");
+ case VARIANT_SIMPLE:
+ die("ssh variant 'simple' does not support setting port");
+ case VARIANT_SSH:
argv_array_push(args, "-p");
- else
+ break;
+ case VARIANT_PLINK:
+ case VARIANT_PUTTY:
+ case VARIANT_TORTOISEPLINK:
argv_array_push(args, "-P");
+ }
argv_array_push(args, port);
}