File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,13 +61,16 @@ def parse_git_service(remote_repo_url: str):
6161 Possible cases we're considering:
6262 - https://github.com/codecov/codecov-cli.git returns github
6363 - git@github.com:codecov/codecov-cli.git returns github
64+ - ssh://git@github.com/gitcodecov/codecov-cli returns github
65+ - ssh://git@github.com:gitcodecov/codecov-cli returns github
6466 - https://user-name@bitbucket.org/namespace-codecov/first_repo.git returns bitbucket
6567 """
6668 services = [service .value for service in GitService ]
6769 parsed_url = urlparse (remote_repo_url )
6870 service = None
6971
70- if remote_repo_url .startswith ("https://" ):
72+ scheme = parsed_url .scheme
73+ if scheme in ("https" , "ssh" ):
7174 netloc = parsed_url .netloc
7275 if "@" in netloc :
7376 netloc = netloc .split ("@" , 1 )[1 ]
Original file line number Diff line number Diff line change 5353 ("ssh://host.abc.xz/owner/repo.git" , "owner/repo" ),
5454 ("user-name@host.xz:owner/repo.git/" , "owner/repo" ),
5555 ("host.xz:owner/repo.git/" , "owner/repo" ),
56+ ("ssh://git@github.com/gitcodecov/codecov-cli" , "gitcodecov/codecov-cli" ),
5657 ],
5758)
5859def test_parse_slug_valid_address (address , slug ):
@@ -107,6 +108,8 @@ def test_parse_slug_invalid_address(address):
107108 "bitbucket" ,
108109 ),
109110 ("git@bitbucket.org:name-codecov/abc.git.git" , "bitbucket" ),
111+ ("ssh://git@github.com/gitcodecov/codecov-cli" , "github" ),
112+ ("ssh://git@github.com:gitcodecov/codecov-cli" , "github" ),
110113 ],
111114)
112115def test_parse_git_service_valid_address (address , git_service ):
You can’t perform that action at this time.
0 commit comments