diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-02-13 23:37:36 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-02-13 23:37:36 +0800 |
commit | de484c6ba035a4b0ed0c0a42212aaedf9788c45c (patch) | |
tree | 90e737d18fa591c40077589407f84dfc69ab8390 /qa | |
parent | 59d49f70c3b36e633b78e82fe3bd85b53f06900b (diff) | |
download | gitlab-ce-de484c6ba035a4b0ed0c0a42212aaedf9788c45c.tar.gz |
Just use initialize and remove scheme we're not using
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/git/location.rb | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/qa/qa/git/location.rb b/qa/qa/git/location.rb index fa3f5721d7a..55f7213972d 100644 --- a/qa/qa/git/location.rb +++ b/qa/qa/git/location.rb @@ -11,26 +11,18 @@ module QA # See: config/initializers/1_settings.rb # Settings#build_gitlab_shell_ssh_path_prefix - def self.parse(git_uri) - if git_uri.start_with?('ssh://') - new(git_uri, URI.parse(git_uri)) + def initialize(git_uri) + @git_uri = git_uri + @uri = if git_uri.start_with?('ssh://') + URI.parse(git_uri) else *rest, path = git_uri.split(':') # Host cannot have : so we'll need to escape it 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 - - def scheme - uri.scheme || 'ssh' - end - def port uri.port || 22 end |