[PATCH] ssh-push: Don't add '/' to pathname

Paths in the host:path notation are usually interpreted
relative to the login directory rather than relative to
the root directory.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Sven Verdoolaege 2005-06-14 12:37:38 +02:00 committed by Linus Torvalds
parent 7737314de7
commit 479346adc5

7
rsh.c
View File

@ -31,14 +31,15 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
} else { } else {
host = url; host = url;
path = strchr(host, ':'); path = strchr(host, ':');
if (path)
*(path++) = '\0';
} }
if (!path) { if (!path) {
return error("Bad URL: %s", url); return error("Bad URL: %s", url);
} }
*(path++) = '\0'; /* ssh <host> 'cd <path>; stdio-pull <arg...> <commit-id>' */
/* ssh <host> 'cd /<path>; stdio-pull <arg...> <commit-id>' */
snprintf(command, COMMAND_SIZE, snprintf(command, COMMAND_SIZE,
"%s='/%s' %s", "%s='%s' %s",
GIT_DIR_ENVIRONMENT, path, remote_prog); GIT_DIR_ENVIRONMENT, path, remote_prog);
posn = command + strlen(command); posn = command + strlen(command);
for (i = 0; i < rmt_argc; i++) { for (i = 0; i < rmt_argc; i++) {