ssh: 'simple' variant does not support --port
[gitweb.git] / connect.c
index c3d1cd37871a50e292f872946ba127e97e62010b..d6033861b35f31aae6c4c93dba7fa5f1c7fac673 100644 (file)
--- 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);
        }