Skip to content

Commit

Permalink
fetch_refspecs: Use dulwich for ssh urls. (#196)
Browse files Browse the repository at this point in the history
Using pygit2 was causing iterative/dvc#9080
  • Loading branch information
daavoo authored Feb 27, 2023
1 parent e8de01e commit dd2ffa9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/scmrepo/git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,18 @@ def fetch_refspecs(
progress: Optional[Callable[["GitProgressEvent"], None]] = None,
**kwargs,
) -> typing.Mapping[str, SyncStatus]:
from urllib.parse import urlparse

from .credentials import get_matching_helper_commands

if "dulwich" in kwargs.get("backends", self.backends.backends) and any(
get_matching_helper_commands(url, self.dulwich.repo.get_config_stack())
):
kwargs["backends"] = ["dulwich"]
if "dulwich" in kwargs.get("backends", self.backends.backends):
credentials_helper = any(
get_matching_helper_commands(url, self.dulwich.repo.get_config_stack())
)
parsed = urlparse(url)
ssh = parsed.scheme in ("git", "git+ssh", "ssh") or url.startswith("git@")
if credentials_helper or ssh:
kwargs["backends"] = ["dulwich"]

return self._fetch_refspecs(
url,
Expand Down

0 comments on commit dd2ffa9

Please sign in to comment.