summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-17 20:03:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-17 20:03:32 (GMT)
commit1945e8ac85c9f2b01d6e431b267fdb259bd50e1f (patch)
tree93b926b2a72991d4dc374329d142409c02ebf248 /transport.c
parent88cb2f96aca8ca8e454e8aa532e54c3c629dbb62 (diff)
parenta2036d7e00ad8aa16ba010a80078e10f0e4568a3 (diff)
downloadgit-1945e8ac85c9f2b01d6e431b267fdb259bd50e1f.zip
git-1945e8ac85c9f2b01d6e431b267fdb259bd50e1f.tar.gz
git-1945e8ac85c9f2b01d6e431b267fdb259bd50e1f.tar.bz2
Merge branch 'tb/clone-ssh-with-colon-for-port'
Be more careful when parsing remote repository URL given in the scp-style host:path notation. * tb/clone-ssh-with-colon-for-port: git_connect(): use common return point connect.c: refactor url parsing git_connect(): refactor the port handling for ssh git fetch: support host:/~repo t5500: add test cases for diag-url git fetch-pack: add --diag-url git_connect: factor out discovery of the protocol and its parts git_connect: remove artificial limit of a remote command t5601: add tests for ssh t5601: remove clear_ssh, refactor setup_ssh_wrapper
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/transport.c b/transport.c
index 8023956..824c5b9 100644
--- a/transport.c
+++ b/transport.c
@@ -885,14 +885,6 @@ void transport_take_over(struct transport *transport,
transport->cannot_reuse = 1;
}
-static int is_local(const char *url)
-{
- const char *colon = strchr(url, ':');
- const char *slash = strchr(url, '/');
- return !colon || (slash && slash < colon) ||
- has_dos_drive_prefix(url);
-}
-
static int is_file(const char *url)
{
struct stat buf;
@@ -941,7 +933,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->fetch = fetch_objs_via_rsync;
ret->push = rsync_transport_push;
ret->smart_options = NULL;
- } else if (is_local(url) && is_file(url) && is_bundle(url, 1)) {
+ } else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) {
struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
ret->data = data;
ret->get_refs_list = get_refs_from_bundle;
@@ -1297,7 +1289,7 @@ char *transport_anonymize_url(const char *url)
size_t anon_len, prefix_len = 0;
anon_part = strchr(url, '@');
- if (is_local(url) || !anon_part)
+ if (url_is_local_not_ssh(url) || !anon_part)
goto literal_copy;
anon_len = strlen(++anon_part);