-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ssh to http conversion for azure devops repos #185
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,7 @@ def remote_branch_name(branch): | |
(?:(?P<user>{regular}*?)@)? | ||
(?P<host>{regular}*?) | ||
: | ||
(?:v3/)? # present in azure ssh urls | ||
(?P<path>{regular}.*)? | ||
$ | ||
""".format( | ||
|
@@ -253,6 +254,16 @@ def get_username(user_, password=None): | |
match = cls.SSH_URL_GIT_SYNTAX.match(url) | ||
if match: | ||
user, host, path = match.groups() | ||
|
||
# handle special azure cases | ||
if "ssh" and "azure" in host: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems pretty specific and I'm not sure we can count on it not appearing in other URLs - I think we need a better way to detect that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For sure. I'm just not aware of other URLs that has this pattern. Generally I guess that you wouldn't expect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could also add a match in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it more general, I suppose one could filter for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mads-oestergaard I think we should just go with an exact string representing the Azure URL (this can be in the default configuration so people might override it if things change) |
||
host = host.replace("ssh.", "") | ||
|
||
# azure http url is different than ssh url | ||
# the format is https://dev.azure.com/{organization}/{project}/_git/{repo} | ||
path_components = path.split("/") | ||
path = "/".join(path_components[:-1]) + "/_git/" + path_components[-1] | ||
|
||
return ( | ||
furl() | ||
.set(scheme="https", username=get_username(user), host=host, path=path) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
("ftp://example.com/a/b/", None), | ||
("github.com:foo/bar.git", "https://github.com/foo/bar.git"), | ||
("[email protected]:foo/bar.git", "https://github.com/foo/bar.git"), | ||
("[email protected]:v3/org/project/repo", "https://dev.azure.com/org/project/_git/repo"), | ||
("bitbucket.org:foo/bar.git", "https://bitbucket.org/foo/bar.git"), | ||
("[email protected]:foo/bar.git", "https://bitbucket.org/foo/bar.git"), | ||
("ssh://bitbucket.org/foo/bar.git", "https://bitbucket.org/foo/bar.git"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mads-oestergaard how is this actually used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It keeps :v3/ out of the
path
group.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used down in line 254