aboutsummaryrefslogtreecommitdiffstats
path: root/http-fetch.c
diff options
context:
space:
mode:
authorNick Hengeveld <nickh@reactrix.com>2005-10-10 23:22:01 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-10 23:22:01 -0700
commit380792390e05e744f9d7eefbc35d1db80e44e27a (patch)
tree62c3b86e4f66a124eeb3bb210d79a02806ff7064 /http-fetch.c
parenta7a8d3786e6b60a472d0f88f778cacaead122a6c (diff)
downloadgit-380792390e05e744f9d7eefbc35d1db80e44e27a.tar.gz
Set the parallel HTTP request limit via an environment variable
Use an environment variable rather than a command-line argument to set the parallel HTTP request limit. This allows the setting to work whether git-http-fetch is run directly or via git-fetch. Signed-off-by: Nick Hengeveld <nickh@reactrix.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'http-fetch.c')
-rw-r--r--http-fetch.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/http-fetch.c b/http-fetch.c
index b034a4508a..dd9ea4ca17 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1034,22 +1034,11 @@ int main(int argc, char **argv)
arg++;
} else if (!strcmp(argv[arg], "--recover")) {
get_recover = 1;
-#ifdef USE_CURL_MULTI
- } else if (argv[arg][1] == 'r') {
- max_requests = atoi(argv[arg + 1]);
- if (max_requests < 1)
- max_requests = DEFAULT_MAX_REQUESTS;
- arg++;
-#endif
}
arg++;
}
if (argc < arg + 2) {
-#ifdef USE_CURL_MULTI
- usage("git-http-fetch [-c] [-t] [-a] [-d] [-v] [-r concurrent-request-limit] [--recover] [-w ref] commit-id url");
-#else
usage("git-http-fetch [-c] [-t] [-a] [-d] [-v] [--recover] [-w ref] commit-id url");
-#endif
return 1;
}
commit_id = argv[arg];
@@ -1058,6 +1047,12 @@ int main(int argc, char **argv)
curl_global_init(CURL_GLOBAL_ALL);
#ifdef USE_CURL_MULTI
+ char *http_max_requests = getenv("GIT_HTTP_MAX_REQUESTS");
+ if (http_max_requests != NULL)
+ max_requests = atoi(http_max_requests);
+ if (max_requests < 1)
+ max_requests = DEFAULT_MAX_REQUESTS;
+
curlm = curl_multi_init();
if (curlm == NULL) {
fprintf(stderr, "Error creating curl multi handle.\n");