From fefefa204d60154eff5afd48ab6d02e5f323063c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 25 Jul 2014 21:08:31 -0700 Subject: [PATCH] Fix `hub browse` help output when not in any repo --- features/browse.feature | 5 +++++ lib/hub/commands.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features/browse.feature b/features/browse.feature index 3d010f88..b1c8af10 100644 --- a/features/browse.feature +++ b/features/browse.feature @@ -2,6 +2,11 @@ Feature: hub browse Background: Given I am "mislav" on github.com with OAuth token "OTOKEN" + Scenario: No repo + When I run `hub browse` + Then the exit status should be 1 + Then the output should contain exactly "Usage: hub browse [/]\n" + Scenario: Project with owner When I successfully run `hub browse mislav/dotfiles` Then there should be no output diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb index 31a923ad..7e92cc27 100644 --- a/lib/hub/commands.rb +++ b/lib/hub/commands.rb @@ -690,7 +690,7 @@ module Hub elsif subpage && !%w[commits tree blob settings].include?(subpage) branch = master_branch project = local_repo.main_project - else + elsif local_repo(false) # $ hub browse prefer_upstream = current_branch && current_branch.master? branch, project = remote_branch_and_project(method(:github_user), prefer_upstream)