Fix `hub browse` on detached HEAD

Fixes #588
This commit is contained in:
Mislav Marohnić 2014-07-05 10:05:13 +08:00
Родитель d9c525c983
Коммит 62c4d8358e
2 изменённых файлов: 13 добавлений и 1 удалений

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

@ -114,6 +114,18 @@ Feature: hub browse
When I successfully run `hub browse`
Then "open https://github.com/mislav/dotfiles/tree/baz/qux/moo" should be run
Scenario: No branch
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And I am in detached HEAD
When I successfully run `hub browse`
Then "open https://github.com/mislav/dotfiles" should be run
Scenario: No branch to pulls
Given I am in "git://github.com/mislav/dotfiles.git" git repo
And I am in detached HEAD
When I successfully run `hub browse -- pulls`
Then "open https://github.com/mislav/dotfiles/pulls" should be run
Scenario: Wiki repo
Given I am in "git://github.com/defunkt/hub.wiki.git" git repo
When I successfully run `hub browse`

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

@ -688,7 +688,7 @@ module Hub
project = local_repo.main_project
else
# $ hub browse
prefer_upstream = current_branch.master?
prefer_upstream = current_branch && current_branch.master?
branch, project = remote_branch_and_project(method(:github_user), prefer_upstream)
branch ||= master_branch
end