Merge branch 'ab/simplify-perl-makefile'
[gitweb.git] / connect.c
index a939323d05afe2df3ff123512dc73d84d2fcf5a3..c3a014c5babf72ee4c0d135fec264afb37b040de 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -889,7 +889,8 @@ static struct child_process *git_connect_git(int fd[2], char *hostandport,
 
        transport_check_allowed("git");
 
-       /* These underlying connection commands die() if they
+       /*
+        * These underlying connection commands die() if they
         * cannot connect.
         */
        if (git_use_proxy(hostandport))
@@ -938,21 +939,49 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
                                 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");
-               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");
+               }
        }
 
        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);
        }