summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2009-12-09 17:26:29 +0200
committerJunio C Hamano <gitster@pobox.com>2009-12-09 12:40:42 -0800
commit25d5cc488a75cc232e97af42759812d9aa398713 (patch)
tree2acb25dde5475a7e0e5d07d24a45c636ab4dfa76 /transport-helper.c
parent28ed5b3524c1ee5245131691b783d897239f5b03 (diff)
downloadgit-25d5cc488a75cc232e97af42759812d9aa398713.tar.gz
Pass unknown protocols to external protocol handlers
Change URL handling to allow external protocol handlers to implement new protocols without the '::' syntax if helper name does not conflict with any built-in protocol. foo:// now invokes git-remote-foo with foo:// as the URL. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 4b17aaa237..271af345e4 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -63,6 +63,16 @@ static void write_constant(int fd, const char *str)
die_errno("Full write to remote helper failed");
}
+const char *remove_ext_force(const char *url)
+{
+ if (url) {
+ const char *colon = strchr(url, ':');
+ if (colon && colon[1] == ':')
+ return colon + 2;
+ }
+ return url;
+}
+
static struct child_process *get_helper(struct transport *transport)
{
struct helper_data *data = transport->data;
@@ -83,7 +93,7 @@ static struct child_process *get_helper(struct transport *transport)
strbuf_addf(&buf, "remote-%s", data->name);
helper->argv[0] = strbuf_detach(&buf, NULL);
helper->argv[1] = transport->remote->name;
- helper->argv[2] = transport->url;
+ helper->argv[2] = remove_ext_force(transport->url);
helper->git_cmd = 1;
if (start_command(helper))
die("Unable to run helper: git %s", helper->argv[0]);