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

fix browse/compare for wiki repos

上级 55a27bab
......@@ -124,6 +124,14 @@ module Hub
if options[:web]
scheme = secure ? 'https:' : 'http:'
path = options[:web] == true ? '' : options[:web].to_s
if repo =~ /\.wiki$/
repo = repo.sub(/\.wiki$/, '')
unless '/wiki' == path
path = '/wiki%s' % if path =~ %r{^/commits/} then '/_history'
else path.sub(/\w+/, '_\0')
end
end
end
'%s//github.com/%s/%s%s' % [scheme, user, repo, path]
else
if secure
......
......@@ -598,6 +598,12 @@ config
"open https://github.com/defunkt/hub/compare/1.0...fix"
end
def test_hub_compare_on_wiki
stub_repo_url 'git://github.com/defunkt/hub.wiki.git'
assert_command "compare 1.0...fix",
"open https://github.com/defunkt/hub/wiki/_compare/1.0...fix"
end
def test_hub_compare_fork
assert_command "compare myfork feature",
"open https://github.com/myfork/hub/compare/feature"
......@@ -654,6 +660,15 @@ config
assert_command "browse --", "open https://github.com/defunkt/hub"
end
def test_hub_browse_current_wiki
stub_repo_url 'git://github.com/defunkt/hub.wiki.git'
assert_command "browse", "open https://github.com/defunkt/hub/wiki"
assert_command "browse -- wiki", "open https://github.com/defunkt/hub/wiki"
assert_command "browse -- commits", "open https://github.com/defunkt/hub/wiki/_history"
assert_command "browse -- pages", "open https://github.com/defunkt/hub/wiki/_pages"
end
def test_hub_browse_current_subpage
assert_command "browse -- network",
"open https://github.com/defunkt/hub/network"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册