提交 5d3a687b 编写于 作者: M Mislav Marohnić

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

上级 504d468d
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册