]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tr/http-updates'
authorJunio C Hamano <gitster@pobox.com>
Sun, 10 Jan 2010 16:53:04 +0000 (08:53 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Jan 2010 16:53:04 +0000 (08:53 -0800)
* tr/http-updates:
  Remove http.authAny
  Allow curl to rewind the RPC read buffer
  Add an option for using any HTTP authentication scheme, not only basic
  http: maintain curl sessions

1  2 
Documentation/config.txt
http.c

diff --combined Documentation/config.txt
index 65dc587f7cbf0f913b79915ba70123fd7189d4f7,b77d66da25bfb098c84f249cde721734e04b1b9d..9f40955f8e74a0263019eb228a548ffd2b1fd301
@@@ -297,24 -297,17 +297,24 @@@ false), while all other repositories ar
  = true).
  
  core.worktree::
 -      Set the path to the working tree.  The value will not be
 -      used in combination with repositories found automatically in
 -      a .git directory (i.e. $GIT_DIR is not set).
 +      Set the path to the root of the work tree.
        This can be overridden by the GIT_WORK_TREE environment
        variable and the '--work-tree' command line option. It can be
 -      a absolute path or relative path to the directory specified by
 -      --git-dir or GIT_DIR.
 -      Note: If --git-dir or GIT_DIR are specified but none of
 +      an absolute path or a relative path to the .git directory,
 +      either specified by --git-dir or GIT_DIR, or automatically
 +      discovered.
 +      If --git-dir or GIT_DIR are specified but none of
        --work-tree, GIT_WORK_TREE and core.worktree is specified,
 -      the current working directory is regarded as the top directory
 -      of your working tree.
 +      the current working directory is regarded as the root of the
 +      work tree.
 ++
 +Note that this variable is honored even when set in a configuration
 +file in a ".git" subdirectory of a directory, and its value differs
 +from the latter directory (e.g. "/path/to/.git/config" has
 +core.worktree set to "/different/path"), which is most likely a
 +misconfiguration.  Running git commands in "/path/to" directory will
 +still use "/different/path" as the root of the work tree and can cause
 +great confusion to the users.
  
  core.logAllRefUpdates::
        Enable the reflog. Updates to a ref <ref> is logged to the file
@@@ -537,7 -530,7 +537,7 @@@ apply.whitespace:
        as the '--whitespace' option. See linkgit:git-apply[1].
  
  branch.autosetupmerge::
 -      Tells 'git-branch' and 'git-checkout' to setup new branches
 +      Tells 'git-branch' and 'git-checkout' to set up new branches
        so that linkgit:git-pull[1] will appropriately merge from the
        starting point branch. Note that even if this option is not set,
        this behavior can be chosen per-branch using the `--track`
@@@ -642,10 -635,10 +642,10 @@@ color.diff.<slot>:
        Use customized color for diff colorization.  `<slot>` specifies
        which part of the patch to use the specified color, and is one
        of `plain` (context text), `meta` (metainformation), `frag`
 -      (hunk header), `old` (removed lines), `new` (added lines),
 -      `commit` (commit headers), or `whitespace` (highlighting
 -      whitespace errors). The values of these variables may be specified as
 -      in color.branch.<slot>.
 +      (hunk header), 'func' (function in hunk header), `old` (removed lines),
 +      `new` (added lines), `commit` (commit headers), or `whitespace`
 +      (highlighting whitespace errors). The values of these variables may be
 +      specified as in color.branch.<slot>.
  
  color.grep::
        When set to `always`, always highlight matches.  When `false` (or
@@@ -725,7 -718,7 +725,7 @@@ diff.autorefreshindex:
        contents in the work tree match the contents in the
        index.  This option defaults to true.  Note that this
        affects only 'git-diff' Porcelain, and not lower level
 -      'diff' commands, such as 'git-diff-files'.
 +      'diff' commands such as 'git-diff-files'.
  
  diff.external::
        If this config variable is set, diff generation is not
@@@ -841,8 -834,8 +841,8 @@@ format.pretty:
  
  format.thread::
        The default threading style for 'git-format-patch'.  Can be
 -      either a boolean value, `shallow` or `deep`.  `shallow`
 -      threading makes every mail a reply to the head of the series,
 +      a boolean value, or `shallow` or `deep`.  `shallow` threading
 +      makes every mail a reply to the head of the series,
        where the head is chosen from the cover letter, the
        `\--in-reply-to`, and the first patch mail, in this order.
        `deep` threading makes every mail a reply to the previous one.
@@@ -875,12 -868,15 +875,12 @@@ gc.autopacklimit:
        default value is 50.  Setting this to 0 disables it.
  
  gc.packrefs::
 -      'git-gc' does not run `git pack-refs` in a bare repository by
 -      default so that older dumb-transport clients can still fetch
 -      from the repository.  Setting this to `true` lets 'git-gc'
 -      to run `git pack-refs`.  Setting this to `false` tells
 -      'git-gc' never to run `git pack-refs`. The default setting is
 -      `notbare`. Enable it only when you know you do not have to
 -      support such clients.  The default setting will change to `true`
 -      at some stage, and setting this to `false` will continue to
 -      prevent `git pack-refs` from being run from 'git-gc'.
 +      Running `git pack-refs` in a repository renders it
 +      unclonable by Git versions prior to 1.5.1.2 over dumb
 +      transports such as HTTP.  This variable determines whether
 +      'git gc' runs `git pack-refs`. This can be set to "nobare"
 +      to enable it within all non-bare repos or it can be set to a
 +      boolean value.  The default is `true`.
  
  gc.pruneexpire::
        When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'.
@@@ -1136,6 -1132,12 +1136,12 @@@ http.maxRequests:
        How many HTTP requests to launch in parallel. Can be overridden
        by the 'GIT_HTTP_MAX_REQUESTS' environment variable. Default is 5.
  
+ http.minSessions::
+       The number of curl sessions (counted across slots) to be kept across
+       requests. They will not be ended with curl_easy_cleanup() until
+       http_cleanup() is invoked. If USE_CURL_MULTI is not defined, this
+       value will be capped at 1. Defaults to 1.
  http.postBuffer::
        Maximum size in bytes of the buffer used by smart HTTP
        transports when POSTing data to the remote system.
@@@ -1465,10 -1467,6 +1471,10 @@@ remote.<name>.tagopt:
        Setting this value to \--no-tags disables automatic tag following when
        fetching from remote <name>
  
 +remote.<name>.vcs::
 +      Setting this to a value <vcs> will cause git to interact with
 +      the remote with the git-remote-<vcs> helper.
 +
  remotes.<group>::
        The list of remotes which are fetched by "git remote update
        <group>".  See linkgit:git-remote[1].
diff --combined http.c
index 455732fb243180bb1101a6b5135f332f9f13fd7a,01e0fdc342d68038e367ea424e663a0beaf22618..5c3efb96d92be775b1ab2debed2920363bbe7355
--- 1/http.c
--- 2/http.c
+++ b/http.c
@@@ -7,6 -7,12 +7,12 @@@ int active_requests
  int http_is_verbose;
  size_t http_post_buffer = 16 * LARGE_PACKET_MAX;
  
+ #if LIBCURL_VERSION_NUM >= 0x070a06
+ #define LIBCURL_CAN_HANDLE_AUTH_ANY
+ #endif
+ static int min_curl_sessions = 1;
+ static int curl_session_count;
  #ifdef USE_CURL_MULTI
  static int max_requests = -1;
  static CURLM *curlm;
@@@ -152,6 -158,14 +158,14 @@@ static int http_options(const char *var
                        ssl_cert_password_required = 1;
                return 0;
        }
+       if (!strcmp("http.minsessions", var)) {
+               min_curl_sessions = git_config_int(var, value);
+ #ifndef USE_CURL_MULTI
+               if (min_curl_sessions > 1)
+                       min_curl_sessions = 1;
+ #endif
+               return 0;
+       }
  #ifdef USE_CURL_MULTI
        if (!strcmp("http.maxrequests", var)) {
                max_requests = git_config_int(var, value);
@@@ -230,6 -244,9 +244,9 @@@ static CURL *get_curl_handle(void
  #if LIBCURL_VERSION_NUM >= 0x070907
        curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
  #endif
+ #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+       curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ #endif
  
        init_curl_http_auth(result);
  
@@@ -372,6 -389,7 +389,7 @@@ void http_init(struct remote *remote
        if (curl_ssl_verify == -1)
                curl_ssl_verify = 1;
  
+       curl_session_count = 0;
  #ifdef USE_CURL_MULTI
        if (max_requests < 1)
                max_requests = DEFAULT_MAX_REQUESTS;
@@@ -480,6 -498,7 +498,7 @@@ struct active_request_slot *get_active_
  #else
                slot->curl = curl_easy_duphandle(curl_default);
  #endif
+               curl_session_count++;
        }
  
        active_requests++;
@@@ -558,9 -577,11 +577,11 @@@ void fill_active_slots(void
        }
  
        while (slot != NULL) {
-               if (!slot->in_use && slot->curl != NULL) {
+               if (!slot->in_use && slot->curl != NULL
+                       && curl_session_count > min_curl_sessions) {
                        curl_easy_cleanup(slot->curl);
                        slot->curl = NULL;
+                       curl_session_count--;
                }
                slot = slot->next;
        }
@@@ -633,12 -654,13 +654,13 @@@ static void closedown_active_slot(struc
  void release_active_slot(struct active_request_slot *slot)
  {
        closedown_active_slot(slot);
-       if (slot->curl) {
+       if (slot->curl && curl_session_count > min_curl_sessions) {
  #ifdef USE_CURL_MULTI
                curl_multi_remove_handle(curlm, slot->curl);
  #endif
                curl_easy_cleanup(slot->curl);
                slot->curl = NULL;
+               curl_session_count--;
        }
  #ifdef USE_CURL_MULTI
        fill_active_slots();
@@@ -1244,7 -1266,7 +1266,7 @@@ int finish_http_object_request(struct h
        process_http_object_request(freq);
  
        if (freq->http_code == 416) {
 -              fprintf(stderr, "Warning: requested range invalid; we may already have all the data.\n");
 +              warning("requested range invalid; we may already have all the data.");
        } else if (freq->curl_result != CURLE_OK) {
                if (stat(freq->tmpfile, &st) == 0)
                        if (st.st_size == 0)