Permalink
Browse files

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

References #152
  • Loading branch information...
1 parent 4b57f61 commit 4c5d26d152d5c63f0f8054acbba5b78b467c52c8 @mislav mislav committed Mar 19, 2012
Showing with 13 additions and 0 deletions.
  1. +4 −0 lib/hub/commands.rb
  2. +9 −0 test/hub_test.rb
View
@@ -73,6 +73,10 @@ def pull_request(args)
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)
View
@@ -861,6 +861,15 @@ def test_pullrequest_from_branch_tracking_local
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')

0 comments on commit 4c5d26d

Please sign in to comment.