X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=rsh.c;fp=rsh.c;h=5615c74e7d5f4e5f9d93c0f90c6f57fe8b41442f;hb=479346adc5ebb099121063d4c06da30093ed9b3b;hp=8eea1d0233164a5d0d4977593538289dd93f722d;hpb=7737314de711aa3a2e4201355777cd41fb791c98;p=git.git diff --git a/rsh.c b/rsh.c index 8eea1d02..5615c74e 100644 --- a/rsh.c +++ b/rsh.c @@ -31,14 +31,15 @@ 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); posn = command + strlen(command); for (i = 0; i < rmt_argc; i++) {