git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/3] revert most of the http_options() change

From
Kyle J. McKay <mackyle@gmail.com>
Date
Jul 30, 2013, 19:14 UTC
Message-ID
<CC3A0EB0-79FE-40C2-B1AC-E3B9683A3ED6@gmail.com>
In-Reply-To
<7v1u6gztf1.fsf_-_@alter.siamese.dyndns.org>
On Jul 29, 2013, at 19:13, Junio C Hamano wrote:
Show 38 quoted lines
> With the previous preparation step, the earlier 1bb00006 (config:
> add support for http.<url>.* settings, 2013-07-21) that introduced
> many repeated changes:
>
>        -if (!strcmp("http.key", var)) {
>        +if (!strcmp("key", key)) {
>        +       if (match_is_shorter(..., OPT_KEY_NAME))
>        +               return 0;
>                ... original processing for KEY_NAME ...
>         }
>
> can be reverted.
>
> This allows us to also get rid of the "repeating yourself to the
> death" enum http_option_type, and new code (like db/http-savecookies
> patch) that wants to add a new configuration to the http.* subsystem
> does not have to conflict with http.<urlpattern>.variable series at
> all.
>
> This is more-or-less how I want the endgame to look like. Not even
> compile tested, but it is getting late so I'll show it to the list
> in case people may want to play with it and polish it while I am
> away for the night ;-).
>
> If people can agree that this is going in the right direction,
> perhaps we should rebuild Kyle's series without detouring of adding
> and then yanking what 1bb00006 (config: add support for http.<url>.*
> settings, 2013-07-21) did in the next cycle.
>
> http.c               | 181 ++++++++ 
> +------------------------------------------
> test-url-normalize.c |   9 ++-
> 2 files changed, 39 insertions(+), 151 deletions(-)
>
> diff --git a/http.c b/http.c
> index a91a00b..c7f513b 100644
> --- a/http.c
> +++ b/http.c
[...]
Show 14 quoted lines
> @@ -469,15 +342,23 @@ void http_init(struct remote *remote, const  
> char *url, int proactive_auth)
> {
> 	char *low_speed_limit;
> 	char *low_speed_time;
> -	struct url_info info;
> +	char *normalized_url;
> +	struct urlmatch_config config = { STRING_LIST_INIT_DUP };
> +
> +	config.fn = http_options;
> +	config.cascade_fn = git_default_config;
> +	config.item_alloc = NULL;
> +	config.item_clear = NULL;
> +	config.cb = NULL;

Missing this: + config.section = "http";

[...]
Show 16 quoted lines
> diff --git a/test-url-normalize.c b/test-url-normalize.c
> index 0b809eb..fab94e5 100644
> --- a/test-url-normalize.c
> +++ b/test-url-normalize.c
> @@ -15,8 +15,15 @@ static int run_http_options(const char *file,
> {
> 	struct strbuf opt_lc;
> 	size_t i, len;
> +	struct urlmatch_config config = { STRING_LIST_INIT_DUP };
>
> -	if (git_config_with_options(http_options, (void *)info, file, 0))
> +	config.fn = http_options;
> +	config.cascade_fn = git_default_config;
> +	config.item_alloc = NULL;
> +	config.item_clear = NULL;
> +	config.cb = NULL;

Missing this: + config.section = "http";

Without these it segfaults running the tests.

However, now the tests that actually check the results using config files are failing:

> # failed 1 among 11 test(s)
I'm looking at it now to see if I can fix the problem.
Previous: Junio C HamanoNext: Kyle J. McKay
Message 15 of 19 in “test-url-normalize.c: Fix gcc errors and sparse warnings”
  1. test-url-normalize.c: Fix gcc errors and sparse warningsRamsay Jones, Jul 24, 2013
  2. Kyle J. McKayJul 24, 2013
  3. Junio C HamanoJul 24, 2013
  4. 0/3 "git config --get-urlmatch $section.$key $url"Junio C Hamano, Jul 29, 2013
  5. 1/3 url-match: split out URL matching logic out of http.cJunio C Hamano, Jul 29, 2013
  6. 2/3 builtin/config: refactor collect_config()Junio C Hamano, Jul 29, 2013
  7. 3/3 config: --get-urlmatchJunio C Hamano, Jul 29, 2013
  8. Jeff KingJul 30, 2013
  9. Junio C HamanoJul 30, 2013
  10. Jeff KingJul 30, 2013
  11. Junio C HamanoJul 30, 2013
  12. Kyle J. McKayJul 30, 2013
  13. 4/3 url-match: generalize configuration collection logicJunio C Hamano, Jul 30, 2013
  14. 5/3 revert most of the http_options() changeJunio C Hamano, Jul 30, 2013
  15. Kyle J. McKayJul 30, 2013
  16. Kyle J. McKayJul 30, 2013
  17. Junio C HamanoJul 30, 2013
  18. Ramsay JonesJul 31, 2013
  19. Junio C HamanoJul 31, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.