Skip to content

Commit

Permalink
🚑 ignore repo trailing slashes
Browse files Browse the repository at this point in the history
git-url-parse does not yet (1.2.2) handle trailing slashes,
which are an optional part of all git URLs, but were supported
before the switch to using GitPython.

Closes #277
  • Loading branch information
jayvdb committed Jul 9, 2019
1 parent 1f6b33e commit f13e613
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- appdirs>=1.2.0
- crayons>= 0.1.0
- GitPython>=2.0.0
- git-url-parse
- git-url-parse>=1.2.2
description: Yet another jinja2 cli command for static text generation
scm_host: github.com
lint_command: make lint install_test format install update
2 changes: 1 addition & 1 deletion min_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml==0.0.9
appdirs==1.2.0
crayons== 0.1.0
GitPython==2.0.0
git-url-parse
git-url-parse==1.2.2
2 changes: 1 addition & 1 deletion moban/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_repo_name(repo_url):
from giturlparse.parser import ParserError

try:
repo = giturlparse.parse(repo_url)
repo = giturlparse.parse(repo_url.rstrip("/"))
return repo.name
except ParserError:
reporter.report_error_message(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml>=0.0.9
appdirs>=1.2.0
crayons>= 0.1.0
GitPython>=2.0.0
git-url-parse
git-url-parse>=1.2.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"appdirs>=1.2.0",
"crayons>= 0.1.0",
"GitPython>=2.0.0",
"git-url-parse",
"git-url-parse>=1.2.2",
]
SETUP_COMMANDS = {}

Expand Down
8 changes: 5 additions & 3 deletions tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ def test_update_existing_with_reference_parameter(

def test_get_repo_name():
repos = [
"https://github.com/sphinx-doc/sphinx",
"https://github.com/repo-abc-def/repo",
"https://github.com/abc/repo",
"https://github.com/abc/repo.git",
"https://github.com/abc/repo/",
"[email protected]:moremoban/moban.git",
"[email protected]:abc/repo.git",
"[email protected]:abc/repo.git",
"git://github.com/abc/repo.git",
]
actual = [get_repo_name(repo) for repo in repos]
expected = ["sphinx", "repo", "repo", "repo", "moban"]
expected = ["repo"] * len(repos)
eq_(expected, actual)


Expand Down

0 comments on commit f13e613

Please sign in to comment.