summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-05-23 05:19:44 -0400
committerJunio C Hamano <gitster@pobox.com>2010-05-24 16:48:34 -0700
commit9d2e942070b235e1f4a0b8dd4c55a6b3f0fe914a (patch)
tree9b5415483a8e35198ab92e188cc98230f8966baf /connect.c
parent638794cde08bb785410a92d293969949a1f5a846 (diff)
downloadgit-9d2e942070b235e1f4a0b8dd4c55a6b3f0fe914a.tar.gz
decode file:// and ssh:// URLs
We generally treat these as equivalent to "/path/to/repo" and "host:path_to_repo" respectively. However, they are URLs and as such may be percent-encoded. The current code simply uses them as-is without any decoding. With this patch, we will now percent-decode any file:// or ssh:// url (or ssh+git, git+ssh, etc) at the transport layer. We continue to treat plain paths and "host:path" syntax literally. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 9ae991ac42..0119bd377b 100644
--- a/connect.c
+++ b/connect.c
@@ -5,6 +5,7 @@
#include "refs.h"
#include "run-command.h"
#include "remote.h"
+#include "url.h"
static char *server_capabilities;
@@ -450,7 +451,7 @@ static struct child_process no_fork;
struct child_process *git_connect(int fd[2], const char *url_orig,
const char *prog, int flags)
{
- char *url = xstrdup(url_orig);
+ char *url;
char *host, *path;
char *end;
int c;
@@ -466,6 +467,11 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
*/
signal(SIGCHLD, SIG_DFL);
+ if (is_url(url_orig))
+ url = url_decode(url_orig);
+ else
+ url = xstrdup(url_orig);
+
host = strstr(url, "://");
if (host) {
*host = '\0';