Commit de484c6b authored by Lin Jen-Shin's avatar Lin Jen-Shin

Just use initialize and remove scheme we're not using

parent 59d49f70
...@@ -11,24 +11,16 @@ module QA ...@@ -11,24 +11,16 @@ module QA
# See: config/initializers/1_settings.rb # See: config/initializers/1_settings.rb
# Settings#build_gitlab_shell_ssh_path_prefix # Settings#build_gitlab_shell_ssh_path_prefix
def self.parse(git_uri) def initialize(git_uri)
if git_uri.start_with?('ssh://') @git_uri = git_uri
new(git_uri, URI.parse(git_uri)) @uri = if git_uri.start_with?('ssh://')
URI.parse(git_uri)
else else
*rest, path = git_uri.split(':') *rest, path = git_uri.split(':')
# Host cannot have : so we'll need to escape it # Host cannot have : so we'll need to escape it
user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1') user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1')
new(git_uri, URI.parse("ssh://#{user_host}/#{path}")) URI.parse("ssh://#{user_host}/#{path}")
end
end
def initialize(git_uri, uri)
@git_uri = git_uri
@uri = uri
end end
def scheme
uri.scheme || 'ssh'
end end
def port def port
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment