From 6a56993b2ec7082521cf14f98ab9fb5a5def4b13 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 5 Aug 2013 13:20:36 -0700 Subject: config: parse http.. using urlmatch Use the urlmatch_config_entry() to wrap the underlying http_options() two-level variable parser in order to set http. to the value with the most specific URL in the configuration. Signed-off-by: Jeff King Signed-off-by: Kyle J. McKay Signed-off-by: Junio C Hamano --- http.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'http.c') diff --git a/http.c b/http.c index 37986f825..5eda356fd 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); -- cgit v1.2.1