Support usernames that contain '@' and ssh Git URLs

Our company-internal Gerrit uses federated logins (Shibboleth/SAML), and
the login names happen to include the at-signs. This needed a patch to
Gerrit ([1], released in 2.13.10) to allow them. Cloning using regular
git tools as well as through the gertty work, but `git-review --list`
complained because it couldn't parse these URLs.

[1] https://gerrit-review.googlesource.com/c/94914/

Change-Id: I6c1c75a585184ee3fb2847c1e6d30802e53f8b4c
This commit is contained in:
Jan Kundrát
2017-02-03 12:22:51 +01:00
committed by Jan Kundrát
parent 514958d3f3
commit 9b68a44f38
2 changed files with 40 additions and 1 deletions

View File

@@ -525,7 +525,7 @@ def parse_gerrit_ssh_params_from_git_url(git_url):
hostname = parsed_url.path[2:].split("/")[0]
if "@" in hostname:
(username, hostname) = hostname.split("@")
(username, _, hostname) = hostname.rpartition("@")
if ":" in hostname:
(hostname, port) = hostname.split(":")