Skip to content

Commit 87a9e91

Browse files
committed
pygit2: apply any URL rewrite rules before checking for supported
remote protocol
1 parent 3e494cd commit 87a9e91

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/scmrepo/git/backend/pygit2/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,13 @@ def _get_remote(self, url: str) -> Generator["Remote", None, None]:
646646
except KeyError as exc:
647647
raise SCMError(f"'{url}' is not a valid Git remote or URL") from exc
648648

649-
parsed = urlparse(url)
650-
if parsed.scheme in ("git", "git+ssh", "ssh") or url.startswith("git@"):
651-
raise NotImplementedError
652649
if os.name == "nt" and url.startswith("file://"):
653650
url = url[len("file://") :]
654-
655-
yield self.repo.remotes.create_anonymous(url)
651+
remote = self.repo.remotes.create_anonymous(url)
652+
parsed = urlparse(remote.url)
653+
if parsed.scheme in ("git", "git+ssh", "ssh") or remote.url.startswith("git@"):
654+
raise NotImplementedError
655+
yield remote
656656

657657
def fetch_refspecs(
658658
self,

0 commit comments

Comments
 (0)