Junio C Hamano wrote: > In that sense, I think http.proxy configuration variable does not go far > enough, even though it might be a step in the right direction. Perhaps > use your configuration variable http.proxy (or "core.environment") to > define the global default, with remote.$name.httpproxy to override it? Sure, why not. Subject: [PATCH] Add remote.<name>.proxy As well as allowing a default proxy option, allow it to be set per-remote. Signed-off-by: Sam Vilain <sam.vilain@xxxxxxxxxxxxxxx> --- Documentation/config.txt | 8 +++++++- remote.c | 2 ++ remote.h | 5 +++++ transport.c | 3 +++ 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 7e6c02a..831df58 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -545,7 +545,8 @@ access method. http.proxy:: Override the HTTP proxy, normally configured using the 'http_proxy' - environment variable (see gitlink:curl[1]). + environment variable (see gitlink:curl[1]). This can be overridden + on a per-remote basis; see remote.<name>.proxy http.sslVerify:: Whether to verify the SSL certificate when fetching or pushing @@ -695,6 +696,11 @@ remote.<name>.url:: The URL of a remote repository. See gitlink:git-fetch[1] or gitlink:git-push[1]. +remote.<name>.proxy:: + For remotes that require curl (http, https and ftp), the URL to + the proxy to use for that remote. Set to the empty string to + disable proxying for that remote. + remote.<name>.fetch:: The default set of "refspec" for gitlink:git-fetch[1]. See gitlink:git-fetch[1]. diff --git a/remote.c b/remote.c index bec2ba1..94df314 100644 --- a/remote.c +++ b/remote.c @@ -278,6 +278,8 @@ static int handle_config(const char *key, const char *value) } else if (!strcmp(subkey, ".tagopt")) { if (!strcmp(value, "--no-tags")) remote->fetch_tags = -1; + } else if (!strcmp(subkey, ".proxy")) { + remote->fetch_refspec = xstrdup(value); } return 0; } diff --git a/remote.h b/remote.h index 878b4ec..2268558 100644 --- a/remote.h +++ b/remote.h @@ -25,6 +25,11 @@ struct remote { const char *receivepack; const char *uploadpack; + + /* + * for curl remotes only + */ + const char *proxy; }; struct remote *remote_get(const char *name); diff --git a/transport.c b/transport.c index 43b9e7c..c62ec88 100644 --- a/transport.c +++ b/transport.c @@ -463,6 +463,9 @@ static struct ref *get_refs_via_curl(const struct transport *transport) curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer); curl_easy_setopt(slot->curl, CURLOPT_URL, refs_url); curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL); + if (transport->remote->proxy) { + curl_easy_setopt(slot->curl, CURLOPT_PROXY, transport->remote->proxy); + } if (start_active_slot(slot)) { run_active_slot(slot); if (results.curl_result != CURLE_OK) { -- 1.5.3.5 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html