summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorKyle J. McKay <mackyle@gmail.com>2013-08-05 13:20:36 -0700
committerJunio C Hamano <gitster@pobox.com>2013-08-05 16:02:03 -0700
commit6a56993b2ec7082521cf14f98ab9fb5a5def4b13 (patch)
tree8a2c3f3f4d5bd6888b8dfd9d2ff87b1c7014ee93 /http.c
parent836b6fb5a56338dc28165284875b257ccfd6c224 (diff)
downloadgit-6a56993b2ec7082521cf14f98ab9fb5a5def4b13.tar.gz
config: parse http.<url>.<variable> using urlmatch
Use the urlmatch_config_entry() to wrap the underlying http_options() two-level variable parser in order to set http.<variable> to the value with the most specific URL in the configuration. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/http.c b/http.c
index 37986f8252..5eda356fd9 100644
--- a/http.c
+++ b/http.c
@@ -3,6 +3,7 @@
#include "sideband.h"
#include "run-command.h"
#include "url.h"
+#include "urlmatch.h"
#include "credential.h"
#include "version.h"
#include "pkt-line.h"
@@ -334,10 +335,20 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
{
char *low_speed_limit;
char *low_speed_time;
+ char *normalized_url;
+ struct urlmatch_config config = { STRING_LIST_INIT_DUP };
+
+ config.section = "http";
+ config.key = NULL;
+ config.collect_fn = http_options;
+ config.cascade_fn = git_default_config;
+ config.cb = NULL;
http_is_verbose = 0;
+ normalized_url = url_normalize(url, &config.url);
- git_config(http_options, NULL);
+ git_config(urlmatch_config_entry, &config);
+ free(normalized_url);
curl_global_init(CURL_GLOBAL_ALL);