Permalink
Browse files

GitHub remote urls don't have to necessarily end in ".git"

  • Loading branch information...
1 parent 539b4c5 commit c69991f3a497e4d7175832a805b01948e4425411 @mislav mislav committed Dec 12, 2011
Showing with 8 additions and 2 deletions.
  1. +3 −2 lib/hub/context.rb
  2. +5 −0 test/hub_test.rb
View
5 lib/hub/context.rb
@@ -233,8 +233,9 @@ def ==(other)
end
def project
- if urls.find { |u| u =~ %r{\bgithub\.com[:/](.+)/(.+).git$} }
- GithubProject.new local_repo, $1, $2
+ if urls.find { |u| u =~ %r{\bgithub\.com[:/](.+)/(.+)\z} }
+ owner = $1
+ GithubProject.new local_repo, owner, $2.sub(/\.git$/, '')
end
end
View
5 test/hub_test.rb
@@ -1045,6 +1045,11 @@ def test_hub_browse_current
assert_command "browse --", "open https://github.com/defunkt/hub"
end
+ def test_hub_browse_current_https_uri
+ stub_repo_url "https://github.com/defunkt/hub"
+ assert_command "browse", "open https://github.com/defunkt/hub"
+ end
+
def test_hub_browse_commit_from_current
assert_command "browse -- commit/6616e4", "open https://github.com/defunkt/hub/commit/6616e4"
end

0 comments on commit c69991f

Please sign in to comment.