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

Re: [PATCH v3 0/6] fix repo name when cloning a server's root

From
Jeff King <peff@peff.net>
Date
Aug 5, 2015, 21:19 UTC
Message-ID
<20150805211947.GC21134@sigill.intra.peff.net>
In-Reply-To
<xmqq4mkd4p1x.fsf@gitster.dls.corp.google.com>
On Wed, Aug 05, 2015 at 10:34:34AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> > As you can see, there is a lot of complexity in there and I'm not
> > convinced this is better than just exposing
> > 'parse_connect_url()', which already handles everything for us.
> 
> If the function "handles everything for us", that's fine, but the
> primary reason I am hesitant is because parse_connect_url() was
> designed specifically not to have to worry about some protocols
> (e.g. I think feeding it a "http://" would fail, and more
> importantly, its current callers want such a call to fail).  Also it
> is meant to handle some non-protocols (e.g. scp style host:path that
> does not follow <scheme>://...).

True, but the transport code _is_ handling that at some point. It makes me wonder if it would be possible to push the call to transport_get further up inside cmd_clone(), and then provide some way to query the remote path and hostname from the transport code. Then guess_dir_name could just go away entirely, in favor of something like:

  dir_name = transport_get_path(transport);
  if (!*dir_name)
	dir_name = transport_get_host(transport);

That may be overly simplistic or unworkable, though. I haven't dug into the code.

> Also does it handle the "2222" case above?  I do not think
> parse_connect_url() even calls get_host_and_port() to be able to
> tell what "2222" means in these examples.

Speaking of which, has anyone tested whether the old or new code handles external remote helpers? Certainly:

  foo::https://host/repo.git

should still use repo.git. But technically the string handed to git-remote-foo does not have to look anything like a URL. In those cases neither guess_dir_name nor the transport code have any idea what anything to the right of the "::" means; we probably have to resort to blind guessing based on characters like colon and slash.

-Peff
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 33 of 53 in “clone: fix repo name when cloning a server's root”
  1. clone: fix repo name when cloning a server's rootPatrick Steinhardt, Jul 27, 2015
  2. Duy NguyenJul 27, 2015
  3. Patrick SteinhardtJul 27, 2015
  4. Junio C HamanoJul 27, 2015
  5. 0/6 clone: fix repo name when cloning a server's rootPatrick Steinhardt, Jul 29, 2015
  6. 1/6 tests: fix broken && chains in t1509-root-worktreePatrick Steinhardt, Jul 29, 2015
  7. 2/6 tests: fix cleanup after tests in t1509-root-worktreePatrick Steinhardt, Jul 29, 2015
  8. 3/6 connect: expose parse_connect_url()Patrick Steinhardt, Jul 29, 2015
  9. 4/6 connect: move error check to caller of parse_connect_urlPatrick Steinhardt, Jul 29, 2015
  10. Eric SunshineJul 29, 2015
  11. Patrick SteinhardtJul 30, 2015
  12. 5/6 clone: fix hostname parsing when guessing dirPatrick Steinhardt, Jul 29, 2015
  13. Junio C HamanoJul 29, 2015
  14. Patrick SteinhardtJul 30, 2015
  15. Junio C HamanoJul 30, 2015
  16. Junio C HamanoJul 30, 2015
  17. Patrick SteinhardtAug 3, 2015
  18. Jeff KingAug 3, 2015
  19. Junio C HamanoAug 3, 2015
  20. 6/6 clone: add tests for cloning with empty pathPatrick Steinhardt, Jul 29, 2015
  21. Eric SunshineJul 30, 2015
  22. Junio C HamanoJul 31, 2015
  23. Patrick SteinhardtJul 31, 2015
  24. 0/6 fix repo name when cloning a server's rootPatrick Steinhardt, Aug 4, 2015
  25. 1/6 tests: fix broken && chains in t1509-root-worktreePatrick Steinhardt, Aug 4, 2015
  26. 2/6 tests: fix cleanup after tests in t1509-root-worktreePatrick Steinhardt, Aug 4, 2015
  27. 3/6 clone: do not include authentication data in guessed dirPatrick Steinhardt, Aug 4, 2015
  28. 4/6 clone: do not use port number as dir namePatrick Steinhardt, Aug 4, 2015
  29. 5/6 clone: abort if no dir name could be guessedPatrick Steinhardt, Aug 4, 2015
  30. 6/6 clone: add tests for cloning with empty pathPatrick Steinhardt, Aug 4, 2015
  31. Eric SunshineAug 4, 2015
  32. Junio C HamanoAug 5, 2015
  33. Jeff KingAug 5, 2015
  34. Torsten BögershausenAug 6, 2015
  35. Junio C HamanoAug 6, 2015
  36. 0/3 fix repo name when cloning a server's rootPatrick Steinhardt, Aug 5, 2015
  37. 1/3 clone: do not include authentication data in guessed dirPatrick Steinhardt, Aug 5, 2015
  38. Junio C HamanoAug 5, 2015
  39. Junio C HamanoAug 5, 2015
  40. Junio C HamanoAug 5, 2015
  41. Patrick SteinhardtAug 6, 2015
  42. Junio C HamanoAug 7, 2015
  43. Patrick SteinhardtAug 8, 2015
  44. 2/3 clone: do not use port number as dir namePatrick Steinhardt, Aug 5, 2015
  45. 3/3 clone: abort if no dir name could be guessedPatrick Steinhardt, Aug 5, 2015
  46. Junio C HamanoAug 5, 2015
  47. 0/5 Improve guessing of repository namesPatrick Steinhardt, Aug 10, 2015
  48. 1/5 clone: add tests for output directoryPatrick Steinhardt, Aug 10, 2015
  49. 2/5 clone: use computed length in guess_dir_namePatrick Steinhardt, Aug 10, 2015
  50. 3/5 clone: do not include authentication data in guessed dirPatrick Steinhardt, Aug 10, 2015
  51. 4/5 clone: do not use port number as dir namePatrick Steinhardt, Aug 10, 2015
  52. 5/5 clone: abort if no dir name could be guessedPatrick Steinhardt, Aug 10, 2015
  53. Junio C HamanoAug 10, 2015

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.