threads / patch / 934

patchssh-push: Don't add '/' to pathname

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

## tl;dr

2 messages between Jun 14, 2005 and Jun 17, 2005. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Sven Verdoolaege· Jun 14, 2005, 10:37 UTC · lore
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>

--- commit 508f3a7ad9d940529ad6736763108fe5c7729171 tree 7332f4cd8f29f0548821f1d0501b2e9a45ae502a parent 200b82de27633d2c85a4358e1be5ae7fab1b077f author Sven Verdoolaege <skimo@liacs.nl> Tue, 14 Jun 2005 12:34:49 +0200 committer Sven Verdoolaege <skimo@liacs.nl> Tue, 14 Jun 2005 12:34:49 +0200

 rsh.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
Show changes to rsh.c +4 −3
diff --git a/rsh.c b/rsh.c
--- a/rsh.c
+++ b/rsh.c
@@ -31,14 +31,15 @@ int setup_connection(int *fd_in, int *fd
 	} else {
 		host = url;
 		path = strchr(host, ':');
+		if (path)
+			*(path++) = '\0';
 	}
 	if (!path) {
 		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, 
-		 "%s='/%s' %s",
+		 "%s='%s' %s",
 		 GIT_DIR_ENVIRONMENT, path, remote_prog);
 	posn = command + strlen(command);
 	for (i = 0; i < rmt_argc; i++) {
Sven Verdoolaege· Jun 17, 2005, 08:13 UTC · re: Sven Verdoolaege · lore

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

Ok, I'm stupid.
This patch has actually been tested.
skimo

-- ssh-push.c: Fix handling of ssh://host/path URLs

Previous patch to fix host:path notation broke handling of ssh://host/path notation.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>

--- commit 4fd62062eb2d52d32cb771feb05bf1ee29d760f9 tree 75ea11a1b6bf7ca17a274b3a8ce2191e7b815e87 parent 7875b50d1a9928e683299b283bfe94778b6c344e author Sven Verdoolaege <skimo@liacs.nl> Fri, 17 Jun 2005 10:08:27 +0200 committer Sven Verdoolaege <skimo@liacs.nl> Fri, 17 Jun 2005 10:08:27 +0200

 rsh.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to rsh.c +1 −0
diff --git a/rsh.c b/rsh.c
--- a/rsh.c
+++ b/rsh.c
@@ -41,6 +41,7 @@ int setup_connection(int *fd_in, int *fd
 	snprintf(command, COMMAND_SIZE, 
 		 "%s='%s' %s",
 		 GIT_DIR_ENVIRONMENT, path, remote_prog);
+	*path = '\0';
 	posn = command + strlen(command);
 	for (i = 0; i < rmt_argc; i++) {
 		*(posn++) = ' ';

← back to recent threads