X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=beaff987c7bc36096d09b2557f5208c5606ce2dd;hb=9b0aa728705439ca4b4e7ec845f79f8487059320;hp=db965c9982f1f2ae7e08331d3fa1d40e194a6520;hpb=c329898abb167f05e37f3d0305e833127a26a4d0;p=git.git diff --git a/connect.c b/connect.c index db965c998..beaff987c 100644 --- a/connect.c +++ b/connect.c @@ -502,12 +502,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 '[]' unwrapping 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 @@ -601,20 +607,9 @@ struct child_process *git_connect(int fd[2], const char *url_orig, *arg++ = host; } else { - /* remove these from the environment */ - const char *env[] = { - ALTERNATE_DB_ENVIRONMENT, - DB_ENVIRONMENT, - GIT_DIR_ENVIRONMENT, - GIT_WORK_TREE_ENVIRONMENT, - GRAFT_ENVIRONMENT, - INDEX_ENVIRONMENT, - NO_REPLACE_OBJECTS_ENVIRONMENT, - NULL - }; - conn->env = env; - *arg++ = "sh"; - *arg++ = "-c"; + /* remove repo-local variables from the environment */ + conn->env = local_repo_env; + conn->use_shell = 1; } *arg++ = cmd.buf; *arg = NULL;