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

Reply to community feedback

From
MMMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Date
Apr 29, 2024, 22:04 UTC
Message-ID
<e7f49f373b2a3b51785d369e1f504825@gmail.com>
In-Reply-To
<20240429205351.GA27257@tb-raspi4>
Thank you for your feedback.
> are there any plans to integrate the parser into connect.c and fetch ?
Yes.

That was my intention but I was not confident enough to touch connect.c before getting feedback from the community, since it's critical code and it is my first contribution.

I do want to merge all URL parsing in git into this one function though, thereby creating a "single point of truth". This is so that if the algorithm is modified the changes are visible to the URL parser builtin as well.

> Speaking as a person, who manage to break the parsing of URLs once,
> with the good intention to improve things, I need to learn that
> test cases are important.
Absolutely agree.

When adding test cases, I looked at the possibilities enumerated in urls.txt and generated test cases based on those. I also looked at the urlmatch.h test cases. However...

> Some work can be seen in t5601-clone.sh
... I did not think to check those.
> Especially, when dealing with literal IPv6 addresses,
> the ones with [] and the simplified ssh syntax 'myhost:src'
> are interesting to test.

You're right about that. I shall prepare an updated v2 patchset with more test cases, and also any other changes/improvements requested by maintainers.

> And some features using the [] syntax to embedd a port number
> inside the simplified ssh syntax had not been documented,
> but used in practise, and are now part of the test suite.
> See "[myhost:123]:src" in t5601

Indeed, I did not read anything of the sort when I checked it. Would you like me to commit a note to this effect to urls.txt ?

> Or is this new tool just a helper, to verify "good" URL's,
> and not accepting our legacy parser quirks ?

It is my intention that this builtin be able to accept, parse and decompose all types of URLs that git itself can accept.

> Then we still should see some IPv6 tests ?
I will add them!
> Or may be not, as we prefer hostnames these days ?

I would have to defer that choice to someone more experienced with the codebase. Please advise on how to proceed.

> The RFC 1738 uses the term "scheme" here, and using the very generic
> term "protocol" may lead to name clashes later.
> Would something like "git_scheme" or so be better ?

Scheme does seem like a better word if it's the terminology used by RFCs. I can change that in a new version if necessary. That code is based on the existing connect.c parsing code though.

> I think that the "///" version is superflous, it should already
> be covered by the "//" version

I thought it was a good idea because of existing precedent: my first approach to creating the test cases was to copy the ones from t0110-urlmatch-normalization.sh which did have many cases such as those. Then as I developed the code I came to believe that it was not necessary: I call url_normalize in the url_parse function and url_normalize is already being tested. I think I just forgot to delete those lines.

Reading that file over once again, it does have IPv6 address test cases. So I should probably go over it again.

Thanks again for the feedback,
  Matheus
Previous: Torsten BögershausenNext: Torsten Bögershausen
Message 19 of 44 in “builtin: implement, document and test url-parse”
  1. 00/13 builtin: implement, document and test url-parseMatheus Moreira via GitGitGadget, Apr 28, 2024
  2. 01/13 url: move helper function to URL header and sourceMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  3. 02/13 urlmatch: define url_parse functionMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  4. Ghanshyam ThakkarMay 1, 2024
  5. Torsten BögershausenMay 2, 2024
  6. 03/13 builtin: create url-parse commandMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  7. 04/13 url-parse: add URL parsing helper functionMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  8. 05/13 url-parse: enumerate possible URL componentsMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  9. 06/13 url-parse: define component extraction helper fnMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  10. 07/13 url-parse: define string to component converter fnMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  11. 08/13 url-parse: define usage and optionsMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  12. 09/13 url-parse: parse options given on the command lineMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  13. 10/13 url-parse: validate all given git URLsMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  14. 11/13 url-parse: output URL components selected by userMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  15. 12/13 Documentation: describe the url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  16. Ghanshyam ThakkarApr 30, 2024
  17. 13/13 tests: add tests for the new url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, Apr 28, 2024
  18. Torsten BögershausenApr 29, 2024
  19. Reply to community feedbackMatheus Afonso Martins Moreira, Apr 29, 2024
  20. Torsten BögershausenApr 30, 2024
  21. 0/8 builtin: implement, document and test url-parseMatheus Moreira via GitGitGadget, May 1, 2026
  22. 1/8 connect: rename enum protocol to url_schemeMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  23. 2/8 url: move url_is_local_not_ssh to url.hMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  24. 3/8 url: move scheme detection to URL header/sourceMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  25. 4/8 url: return URL_SCHEME_UNKNOWN instead of dyingMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  26. 5/8 urlmatch: define url_parse functionMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  27. 6/8 builtin: create url-parse commandMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  28. 7/8 doc: describe the url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  29. 8/8 t9904: add tests for the new url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, May 1, 2026
  30. 0/8 builtin: implement, document and test url-parseMatheus Moreira via GitGitGadget, May 2, 2026
  31. 1/8 connect: rename enum protocol to url_schemeMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  32. 2/8 url: move url_is_local_not_ssh to url.hMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  33. 3/8 url: move scheme detection to URL header/sourceMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  34. 4/8 url: return URL_SCHEME_UNKNOWN instead of dyingMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  35. 5/8 urlmatch: define url_parse functionMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  36. 6/8 builtin: create url-parse commandMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  37. 7/8 doc: describe the url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  38. 8/8 t9904: add tests for the new url-parse builtinMatheus Afonso Martins Moreira via GitGitGadget, May 2, 2026
  39. Junio C HamanoMay 3, 2026
  40. Matheus Afonso Martins MoreiraMay 3, 2026
  41. Torsten BögershausenMay 3, 2026
  42. Matheus Afonso Martins MoreiraMay 3, 2026
  43. Junio C HamanoMay 12, 2026
  44. Torsten BögershausenMay 12, 2026

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.