git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Kyle J. McKay" <mackyle@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: GIT Mailing-list <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 5/3] revert most of the http_options() change
Date: Tue, 30 Jul 2013 12:41:37 -0700	[thread overview]
Message-ID: <3C93D9D6-8FC3-4D94-AE6E-37150202314A@gmail.com> (raw)
In-Reply-To: <CC3A0EB0-79FE-40C2-B1AC-E3B9683A3ED6@gmail.com>


On Jul 30, 2013, at 12:14, Kyle J. McKay wrote:

> On Jul 29, 2013, at 19:13, Junio C Hamano wrote:
>
>> 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
> [...]
>> @@ -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";
>
>
> [...]
>> 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 };

Also needs this:

+	memcpy(&config.url, info, sizeof(struct url_info));

>> -	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.

And now all the t5200-url-normalize tests pass again.

FYI, I couldn't get the patches to apply against next or pu without  
some minor tweaks that were just conflict resolutions having to do  
with git_config_with_options changing its signature.

  reply	other threads:[~2013-07-30 19:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 19:07 [PATCH] test-url-normalize.c: Fix gcc errors and sparse warnings Ramsay Jones
2013-07-24 19:35 ` Kyle J. McKay
2013-07-24 20:39   ` Junio C Hamano
2013-07-29 22:49     ` [PATCH 0/3] "git config --get-urlmatch $section.$key $url" Junio C Hamano
2013-07-29 22:49       ` [PATCH 1/3] url-match: split out URL matching logic out of http.c Junio C Hamano
2013-07-29 22:49       ` [PATCH 2/3] builtin/config: refactor collect_config() Junio C Hamano
2013-07-29 22:49       ` [PATCH 3/3] config: --get-urlmatch Junio C Hamano
2013-07-30  0:37         ` Jeff King
2013-07-30  1:33           ` Junio C Hamano
2013-07-30  8:14             ` Jeff King
2013-07-30 13:52               ` Junio C Hamano
2013-07-30 19:14         ` Kyle J. McKay
2013-07-30  2:03       ` [PATCH 4/3] url-match: generalize configuration collection logic Junio C Hamano
2013-07-30  2:13         ` [PATCH 5/3] revert most of the http_options() change Junio C Hamano
2013-07-30 19:14           ` Kyle J. McKay
2013-07-30 19:41             ` Kyle J. McKay [this message]
2013-07-30 21:09               ` Junio C Hamano
2013-07-31 17:59       ` [PATCH 0/3] "git config --get-urlmatch $section.$key $url" Ramsay Jones
2013-07-31 19:31         ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=3C93D9D6-8FC3-4D94-AE6E-37150202314A@gmail.com \
    --to=mackyle@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).