Skip to content

Commit 4652564

Browse files
committed
fix(parse,git): Improve user matching
1 parent a68d995 commit 4652564

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libvcs/parse/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ def register(self, cls: Matcher) -> None:
131131
>>> GitURLWithPip(url="git+ssh://git@github.com/tony/AlgoXY.git")
132132
GitURLWithPip(url=git+ssh://git@github.com/tony/AlgoXY.git,
133133
scheme=git+ssh,
134-
hostname=git@github.com,
134+
hostname=github.com,
135135
path=tony/AlgoXY,
136+
user=git,
136137
suffix=.git,
137138
matcher=pip-url)
138139
""" # NOQA: E501

libvcs/parse/git.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# We modified it to have groupings
3030
SCP_REGEX = r"""
3131
# Optional user, e.g. 'git@'
32-
(?P<user>(\w+))?@
32+
((?P<user>\w+)@)?
3333
# Server, e.g. 'github.com'.
3434
(?P<hostname>([^/:]+)):
3535
# The server-side path. e.g. 'user/project.git'. Must start with an
@@ -39,6 +39,7 @@
3939
"""
4040

4141
RE_PATH = r"""
42+
((?P<user>\w+)@)?
4243
(?P<hostname>([^/:]+))
4344
(:(?P<port>\d{1,5}))?
4445
(?P<separator>[:,/])?

0 commit comments

Comments
 (0)