pull-request: better error message for invalid remotes/URLs

References #152
This commit is contained in:
Mislav Marohnić 2012-03-19 17:24:25 +01:00
Родитель 4b57f61e5a
Коммит 4c5d26d152
2 изменённых файлов: 13 добавлений и 0 удалений

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

@ -73,6 +73,10 @@ module Hub
base_project = local_repo.main_project
head_project = local_repo.current_project
unless base_project
abort "Aborted: the origin remote doesn't point to a GitHub repository."
end
from_github_ref = lambda do |ref, context_project|
if ref.index(':')
owner, ref = ref.split(':', 2)

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

@ -861,6 +861,15 @@ class HubTest < Test::Unit::TestCase
assert_output expected, "pull-request hereyougo -f"
end
def test_pullrequest_invalid_remote
stub_repo_url('gh:singingwolfboy/sekrit.git')
stub_branch('refs/heads/feature')
stub_tracking('feature', 'origin', 'feature')
expected = "Aborted: the origin remote doesn't point to a GitHub repository.\n"
assert_output expected, "pull-request hereyougo"
end
def test_pullrequest_enterprise_no_tracking
stub_hub_host('git.my.org')
stub_repo_url('git@git.my.org:defunkt/hub.git')