Code

Allow use of []-wrapped addresses in git://
[git.git] / connect.c
index 7945e38ac1c99c09f7975ae99767bc9747ac3740..5145d1620c2f58cd6904b5957cbf2e1785f9de37 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -523,12 +523,18 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
                c = ':';
        }
 
+       /*
+        * Don't do destructive transforms with git:// as that
+        * protocol code does '[]' dewrapping of its own.
+        */
        if (host[0] == '[') {
                end = strchr(host + 1, ']');
                if (end) {
-                       *end = 0;
+                       if (protocol != PROTO_GIT) {
+                               *end = 0;
+                               host++;
+                       }
                        end++;
-                       host++;
                } else
                        end = host;
        } else