git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: git@vger.kernel.org
Subject: [PATCH] Set the parallel HTTP request limit via an environment variable
Date: Fri, 7 Oct 2005 08:59:54 -0700	[thread overview]
Message-ID: <20051007155954.GJ15593@reactrix.com> (raw)

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>


---

 http-fetch.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

a508fd4ba7300476e6ad029fca10371ca869af1e
diff --git a/http-fetch.c b/http-fetch.c
--- 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");

                 reply	other threads:[~2005-10-07 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051007155954.GJ15593@reactrix.com \
    --to=nickh@reactrix.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).