зеркало из https://github.com/mislav/hub.git
Make `browse` and `compare` respect `protocol` config option
Allows using these commands for Enterprise configurations over regular HTTP.
This commit is contained in:
Родитель
7944d63edb
Коммит
641ea1d1db
|
@ -142,3 +142,17 @@ Feature: hub browse
|
|||
And the "upstream" remote has url "../path/to/another/repo.git"
|
||||
When I successfully run `hub browse`
|
||||
Then "open https://github.com/mislav/dotfiles" should be run
|
||||
|
||||
Scenario: Enterprise repo
|
||||
Given I am in "git://git.my.org/mislav/dotfiles.git" git repo
|
||||
And I am "mislav" on git.my.org with OAuth token "FITOKEN"
|
||||
And "git.my.org" is a whitelisted Enterprise host
|
||||
When I successfully run `hub browse`
|
||||
Then "open https://git.my.org/mislav/dotfiles" should be run
|
||||
|
||||
Scenario: Enterprise repo over HTTP
|
||||
Given I am in "git://git.my.org/mislav/dotfiles.git" git repo
|
||||
And I am "mislav" on http://git.my.org with OAuth token "FITOKEN"
|
||||
And "git.my.org" is a whitelisted Enterprise host
|
||||
When I successfully run `hub browse`
|
||||
Then "open http://git.my.org/mislav/dotfiles" should be run
|
||||
|
|
|
@ -81,3 +81,11 @@ Feature: hub compare
|
|||
When I successfully run `hub compare anotheruser feature`
|
||||
Then there should be no output
|
||||
And "open https://github.com/anotheruser/dotfiles/compare/feature" should be run
|
||||
|
||||
Scenario: Enterprise repo over HTTP
|
||||
Given the "origin" remote has url "git://git.my.org/mislav/dotfiles.git"
|
||||
And I am "mislav" on http://git.my.org with OAuth token "FITOKEN"
|
||||
And "git.my.org" is a whitelisted Enterprise host
|
||||
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
|
||||
|
|
|
@ -693,7 +693,7 @@ module Hub
|
|||
"/#{subpage}"
|
||||
end
|
||||
|
||||
project.web_url(path)
|
||||
project.web_url(path, api_client.config.method(:protocol))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -724,7 +724,8 @@ module Hub
|
|||
end
|
||||
end
|
||||
|
||||
project.web_url "/compare/#{range.tr('/', ';')}"
|
||||
path = '/compare/%s' % range.tr('/', ';')
|
||||
project.web_url(path, api_client.config.method(:protocol))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ module Hub
|
|||
local_repo.remotes.find { |r| r.project == self }
|
||||
end
|
||||
|
||||
def web_url(path = nil)
|
||||
def web_url(path = nil, protocol_config = nil)
|
||||
project_name = name_with_owner
|
||||
if project_name.sub!(/\.wiki$/, '')
|
||||
unless '/wiki' == path
|
||||
|
@ -298,7 +298,11 @@ module Hub
|
|||
path = '/wiki' + path
|
||||
end
|
||||
end
|
||||
"https://#{host}/" + project_name + path.to_s
|
||||
'%s://%s/%s' % [
|
||||
protocol_config ? protocol_config.call(host) : 'https',
|
||||
host,
|
||||
project_name + path.to_s
|
||||
]
|
||||
end
|
||||
|
||||
def git_url(options = {})
|
||||
|
|
Загрузка…
Ссылка в новой задаче