Skip to content

Commit 0300d57

Browse files
kounoikeguyzmo
authored andcommitted
Adds missing ssh:// URL support for _guess_repo_slug.
1 parent 47a502c commit 0300d57

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

git_repo/repo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ def _guess_repo_slug(self, repository, service, resolve_targets=None):
163163
for remote in repository.remotes:
164164
if remote.name in targets:
165165
for url in remote.urls:
166-
if url.startswith('https'):
167-
if url.endswith('.git'):
168-
url = url[:-4]
166+
if url.endswith('.git'):
167+
url = url[:-4]
168+
if url.find('://') > -1:
169+
# http://, https:// and ssh://
169170
*_, user, name = url.split('/')
170171
self.set_repo_slug('/'.join([user, name]))
171172
return
172-
elif url.startswith('git@'):
173-
if url.endswith('.git'):
174-
url = url[:-4]
173+
elif url.find('@') > -1 and url.find(':') > -1:
174+
# scp-style URL
175175
_, repo_slug = url.split(':')
176176
self.set_repo_slug(repo_slug)
177177
return

0 commit comments

Comments
 (0)