X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=rsh.c;h=fe87e581d21d0465da9e3fadef0454c69640caa7;hb=98e031f0bb6e857c684e6db24d03d22cfc1a532a;hp=8eea1d0233164a5d0d4977593538289dd93f722d;hpb=001d4a27dbfaaa59c25dc35dafc69bd9b9bc21d3;p=git.git diff --git a/rsh.c b/rsh.c index 8eea1d02..fe87e581 100644 --- a/rsh.c +++ b/rsh.c @@ -31,15 +31,17 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog, } else { host = url; path = strchr(host, ':'); + if (path) + *(path++) = '\0'; } if (!path) { return error("Bad URL: %s", url); } - *(path++) = '\0'; - /* ssh 'cd /; stdio-pull ' */ + /* ssh 'cd ; stdio-pull ' */ snprintf(command, COMMAND_SIZE, - "%s='/%s' %s", + "%s='%s' %s", GIT_DIR_ENVIRONMENT, path, remote_prog); + *path = '\0'; posn = command + strlen(command); for (i = 0; i < rmt_argc; i++) { *(posn++) = ' ';