提交 70a62f8a 编写于 作者: L Luismi Cavalle 提交者: Mislav Marohnić

friendly error for `pull-request` in detached HEAD

上级 07559d1c
......@@ -3,6 +3,13 @@ Feature: hub pull-request
Given I am in "dotfiles" git repo
And I am "mislav" on github.com with OAuth token "OTOKEN"
Scenario: Detached HEAD
Given the "origin" remote has url "git://github.com/mislav/coral.git"
And I am in detached HEAD
When I run `hub pull-request`
Then the stderr should contain "Aborted: not currently on any branch.\n"
And the exit status should be 1
Scenario: Non-GitHub repo
Given the "origin" remote has url "mygh:Manganeez/repo.git"
When I run `hub pull-request`
......
......@@ -69,6 +69,12 @@ Given /^I am on the "([^"]+)" branch(?: with upstream "([^"]+)")?$/ do |name, up
run_silent %(git checkout --quiet -B #{name} --track #{upstream})
end
Given /^I am in detached HEAD$/ do
empty_commit
empty_commit
run_silent %(git checkout HEAD^)
end
Given /^the current dir is not a repo$/ do
in_current_dir do
FileUtils.rm_rf '.git'
......
......@@ -81,6 +81,10 @@ module Hub
base_project = local_repo.main_project
head_project = local_repo.current_project
unless current_branch
abort "Aborted: not currently on any branch."
end
unless base_project
abort "Aborted: the origin remote doesn't point to a GitHub repository."
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册