Skip to content

Commit

Permalink
Apply insteadOf to rsync-style location strings as well
Browse files Browse the repository at this point in the history
Previously, these were just applied to plain URLs.

Fixes python-poetry/poetry#6329
  • Loading branch information
jelmer committed Sep 4, 2022
1 parent 0877eb1 commit 9cf53c8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2325,6 +2331,7 @@ def parse_rsync_url(location: str) -> Tuple[Optional[str], str, str]:

def get_transport_and_path(
location: str,
config: Optional[Config] = None,
operation: Optional[str] = None,
**kwargs: Any
) -> Tuple[GitClient, str]:
Expand All @@ -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

Expand Down

0 comments on commit 9cf53c8

Please sign in to comment.