commit 9cf53c8da79663020e380143edc647da826ba408 from: Jelmer Vernooij date: Sun Sep 04 23:40:47 2022 UTC Apply insteadOf to rsync-style location strings as well Previously, these were just applied to plain URLs. Fixes python-poetry/poetry#6329 commit - 0877eb1147c649e3ea5a4e7125ed664525480549 commit + 9cf53c8da79663020e380143edc647da826ba408 blob - 191aa74318864fdf1ccf8477f833335955a324e0 blob + cf2e2c516350dafdb60847ebb3adcb2c7614f22c --- dulwich/client.py +++ dulwich/client.py @@ -2283,6 +2283,12 @@ def get_transport_and_path_from_url( """ if config is not None: url = apply_instead_of(config, url, push=(operation == "push")) + + return _get_transport_and_path_from_url( + url, config=config, operation=operation, **kwargs) + + +def _get_transport_and_path_from_url(url, config, operation, **kwargs): parsed = urlparse(url) if parsed.scheme == "git": return (TCPGitClient.from_parsedurl(parsed, **kwargs), parsed.path) @@ -2325,6 +2331,7 @@ def parse_rsync_url(location: str) -> Tuple[Optional[s def get_transport_and_path( location: str, + config: Optional[Config] = None, operation: Optional[str] = None, **kwargs: Any ) -> Tuple[GitClient, str]: @@ -2342,9 +2349,13 @@ def get_transport_and_path( Tuple with client instance and relative path. """ + if config is not None: + location = apply_instead_of(config, location, push=(operation == "push")) + # First, try to parse it as a URL try: - return get_transport_and_path_from_url(location, operation=operation, **kwargs) + return _get_transport_and_path_from_url( + location, config=config, operation=operation, **kwargs) except ValueError: pass