Skip to content

Commit

Permalink
Merge pull request #38 from jayvdb/git-at-ports
Browse files Browse the repository at this point in the history
Support ports for git@ URLs
  • Loading branch information
retr0h authored Jul 9, 2019
2 parents 98a5377 + 22a11b3 commit a6901cf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions giturlparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
r'(?P<pathname>(\/(?P<owner>\w+)/)?'
r'(\/?(?P<name>[\w\-]+)(\.git)?)?)$'),
re.compile(r'^(?:(?P<user>.+)@)*'
r'(?P<resource>[a-z0-9_.-]*)[:/]*'
r'(?P<resource>[a-z0-9_.-]*)[:]*'
r'(?P<port>[\d]+){0,1}'
r'[:](?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)$'),
r'(?P<pathname>\/?(?P<owner>.+)/(?P<name>.+).git)$'),
re.compile(r'((?P<user>\w+)@)?'
r'((?P<resource>[\w\.\-]+))'
r'[\:\/]{1,2}'
Expand Down
34 changes: 34 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,17 @@ def second_match_urls():
'name': 'repo',
'owner': 'owner',
},
'git+ssh://example.com:9999/owner/repo.git': {
'pathname': '/owner/repo.git',
'protocols': ['git', 'ssh'],
'protocol': 'ssh',
'href': 'git+ssh://example.com:9999/owner/repo.git',
'resource': 'example.com',
'user': None,
'port': '9999',
'name': 'repo',
'owner': 'owner',
},
'git+https://example.com/owner/repo.git': {
'pathname': '/owner/repo.git',
'protocols': ['git', 'https'],
Expand All @@ -288,6 +299,17 @@ def second_match_urls():
'name': 'repo',
'owner': 'owner',
},
'git+https://example.com:9999/owner/repo.git': {
'pathname': '/owner/repo.git',
'protocols': ['git', 'https'],
'protocol': 'https',
'href': 'git+https://example.com:9999/owner/repo.git',
'resource': 'example.com',
'user': None,
'port': '9999',
'name': 'repo',
'owner': 'owner',
},
}


Expand Down Expand Up @@ -327,6 +349,18 @@ def third_match_urls():
'name': 'repo',
'owner': 'owner',
},
# GitLab
'[email protected]:9999/owner/repo.git': {
'pathname': '/owner/repo.git',
'protocols': [],
'protocol': 'ssh',
'href': '[email protected]:9999/owner/repo.git',
'resource': 'foo-example.com',
'user': 'user',
'port': '9999',
'name': 'repo',
'owner': 'owner',
},
}


Expand Down

0 comments on commit a6901cf

Please sign in to comment.