GitHub remote urls don't have to necessarily end in ".git"

This commit is contained in:
Mislav Marohnić 2011-12-12 12:57:31 +01:00
Родитель 539b4c52dd
Коммит c69991f3a4
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -233,8 +233,9 @@ module Hub
end
def project
if urls.find { |u| u =~ %r{\bgithub\.com[:/](.+)/(.+).git$} }
GithubProject.new local_repo, $1, $2
if urls.find { |u| u =~ %r{\bgithub\.com[:/](.+)/(.+)\z} }
owner = $1
GithubProject.new local_repo, owner, $2.sub(/\.git$/, '')
end
end

Просмотреть файл

@ -1045,6 +1045,11 @@ config
assert_command "browse --", "open https://github.com/defunkt/hub"
end
def test_hub_browse_current_https_uri
stub_repo_url "https://github.com/defunkt/hub"
assert_command "browse", "open https://github.com/defunkt/hub"
end
def test_hub_browse_commit_from_current
assert_command "browse -- commit/6616e4", "open https://github.com/defunkt/hub/commit/6616e4"
end