Skip to content

Commit

Permalink
Merge pull request #2018 from amarshall/fix-git-url-pattern
Browse files Browse the repository at this point in the history
Fix non-compliant Git URL matching
  • Loading branch information
finswimmer authored Feb 11, 2020
2 parents ed44342 + 7348893 commit 7d5934e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poetry/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"[^@#]+",
}

Expand Down
16 changes: 16 additions & 0 deletions tests/vcs/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 7d5934e

Please sign in to comment.