diff --git a/poetry/vcs/git.py b/poetry/vcs/git.py index baa957ed8a6..791e68dd1af 100644 --- a/poetry/vcs/git.py +++ b/poetry/vcs/git.py @@ -12,8 +12,8 @@ "user": r"[a-zA-Z0-9_.-]+", "resource": r"[a-zA-Z0-9_.-]+", "port": r"\d+", - "path": r"[\w\-/\\]+", - "name": r"[\w\-]+", + "path": r"[\w~.\-/\\]+", + "name": r"[\w~.\-]+", "rev": r"[^@#]+", } diff --git a/tests/vcs/test_git.py b/tests/vcs/test_git.py index f0157db364e..062272151fb 100644 --- a/tests/vcs/test_git.py +++ b/tests/vcs/test_git.py @@ -20,6 +20,10 @@ "git+https://user@hostname/project/blah.git", GitUrl("https://user@hostname/project/blah.git", None), ), + ( + "git+https://user@hostname/project~_-.foo/blah~_-.bar.git", + GitUrl("https://user@hostname/project~_-.foo/blah~_-.bar.git", None), + ), ( "git+https://user@hostname:project/blah.git", GitUrl("https://user@hostname/project/blah.git", None), @@ -98,6 +102,18 @@ def test_normalize_url(url, normalized): "https", "hostname", "/project/blah.git", "user", None, "blah", None ), ), + ( + "git+https://user@hostname/project~_-.foo/blah~_-.bar.git", + ParsedUrl( + "https", + "hostname", + "/project~_-.foo/blah~_-.bar.git", + "user", + None, + "blah~_-.bar", + None, + ), + ), ( "git+https://user@hostname:project/blah.git", ParsedUrl(