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

Re: [PATCH v8 3/4] tests: add new test for the url_normalize function

From
Jeff King <peff@peff.net>
Date
Jul 24, 2013, 06:59 UTC
Message-ID
<20130724065933.GC30074@sigill.intra.peff.net>
In-Reply-To
<60d85be89d27515d913ae15e10c332f@f74d39fa044aa309eaea14b9f57fe79>
On Mon, Jul 22, 2013 at 05:56:43AM -0700, Kyle J. McKay wrote:
Show 5 quoted lines
> In order to perform sane URL matching for http.<url>.* options,
> http.c normalizes URLs before performing matches.
> 
> A new test-url-normalize test program is introduced along with
> a new t5200-url-normalize.sh script to run the tests.

While looking at test-url-normalize (and wanting to experiment some with your series to see how it handled a few behaviors), I wondered if we shouldn't be exposing this selection process to the user somehow via git-config.

That is, would a shell script ever want to say "what is the value of this config variable for url $X"? Certainly our test scripts want to, and having a test-* program covers that, but might user scripts want to do the same? Or even to introduce its own URL-matched config options?

How hard would it be to convert the "-c" option of test-url-normalize into something like:

  git config --file=foo --url http noepsv $URL
which would look for http.$URL.noepsv matches.

If we want to go that route, we don't have to do it now (the test-* interface is unpublished, and the git-config interface can simply come later than the internal feature). But it may be worth thinking about now while it is in your head.

Show 19 quoted lines
> diff --git a/test-url-normalize.c b/test-url-normalize.c
> new file mode 100644
> index 0000000..f18bd88
> --- /dev/null
> +++ b/test-url-normalize.c
> [...]
> +	if (!strcmp("sslverify", opt_lc.buf))
> +		printf("%s\n", curl_ssl_verify ? "true" : "false");
> +	else if (!strcmp("sslcert", opt_lc.buf))
> +		printf("%s\n", ssl_cert);
> +#if LIBCURL_VERSION_NUM >= 0x070903
> +	else if (!strcmp("sslkey", opt_lc.buf))
> +		printf("%s\n", ssl_key);
> +#endif
> +#if LIBCURL_VERSION_NUM >= 0x070908
> +	else if (!strcmp("sslcapath", opt_lc.buf))
> +		printf("%s\n", ssl_capath);
> +#endif
> [...]

Do we need to have the complete list of options here, including curl version limitations? It seems like this will eventually get out of date with the list of options. Would it be sufficient to test just one (or even just handle a fake "http.$URL.foo" variable)?

> +#define url_normalize(u) http_options_url_normalize(u)

Does this macro do anything besides shorten the name? Is the extra level of indirection to the reader worth it?

-Peff
Previous: Kyle J. McKayNext: Junio C Hamano
Message 6 of 19 in “config: add support for http.<url>.* settings”
  1. 0/4 config: add support for http.<url>.* settingsKyle J. McKay, Jul 22, 2013
  2. 1/4 config: add support for http.<url>.* settingsKyle J. McKay, Jul 22, 2013
  3. Jeff KingJul 24, 2013
  4. 2/4 config: improve support for http.<url>.* settingsKyle J. McKay, Jul 22, 2013
  5. 3/4 tests: add new test for the url_normalize functionKyle J. McKay, Jul 22, 2013
  6. Jeff KingJul 24, 2013
  7. Junio C HamanoJul 24, 2013
  8. Kyle J. McKayJul 24, 2013
  9. Kyle J. McKayJul 24, 2013
  10. Jeff KingJul 24, 2013
  11. 4/4 config: allow http.<url>.* any user matchingKyle J. McKay, Jul 22, 2013
  12. Junio C HamanoJul 22, 2013
  13. Kyle J. McKayJul 22, 2013
  14. Junio C HamanoJul 22, 2013
  15. Kyle J. McKayJul 22, 2013
  16. Junio C HamanoJul 22, 2013
  17. Jeff KingJul 24, 2013
  18. Junio C HamanoJul 24, 2013
  19. Jeff KingJul 24, 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.