Fix `compare` crash when used on a non-GitHub repo

This commit is contained in:
Mislav Marohnić 2015-09-28 16:22:34 +02:00
Родитель 504d468d0f
Коммит 5d3a687bff
2 изменённых файлов: 16 добавлений и 0 удалений

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

@ -89,6 +89,11 @@ func compare(command *Command, args *Args) {
}
}
if project == nil {
project, err = localRepo.CurrentProject()
utils.Check(err)
}
subpage := utils.ConcatPaths("compare", rangeQueryEscape(r))
url := project.WebURL("", "", subpage)
launcher, err := utils.BrowserLauncher()

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

@ -136,3 +136,14 @@ Feature: hub compare
When I successfully run `hub compare refactor`
Then there should be no output
And "open http://git.my.org/mislav/dotfiles/compare/refactor" should be run
Scenario: Compare in non-GitHub repo
Given the "origin" remote has url "git@bitbucket.org:mislav/dotfiles.git"
And I am on the "feature" branch
When I run `hub compare`
Then the stdout should contain exactly ""
And the stderr should contain exactly:
"""
Aborted: the origin remote doesn't point to a GitHub repository.\n
"""
And the exit status should be 1