Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
59d49f70
Commit
59d49f70
authored
Feb 13, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Git::Repository::Location to Git::Location
parent
565fdd63
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
44 deletions
+41
-44
qa/qa.rb
qa/qa.rb
+1
-0
qa/qa/git/location.rb
qa/qa/git/location.rb
+39
-0
qa/qa/git/repository.rb
qa/qa/git/repository.rb
+0
-2
qa/qa/git/repository/location.rb
qa/qa/git/repository/location.rb
+0
-41
qa/spec/git/location_spec.rb
qa/spec/git/location_spec.rb
+1
-1
No files found.
qa/qa.rb
View file @
59d49f70
...
...
@@ -169,6 +169,7 @@ module QA
#
module
Git
autoload
:Repository
,
'qa/git/repository'
autoload
:Location
,
'qa/git/location'
end
##
...
...
qa/qa/git/location.rb
0 → 100644
View file @
59d49f70
require
'uri'
require
'forwardable'
module
QA
module
Git
class
Location
extend
Forwardable
attr_reader
:git_uri
,
:uri
def_delegators
:@uri
,
:user
,
:host
,
:path
# 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
))
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
}
"
))
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
end
end
end
qa/qa/git/repository.rb
View file @
59d49f70
...
...
@@ -4,8 +4,6 @@ require 'uri'
module
QA
module
Git
class
Repository
autoload
:Location
,
'qa/git/repository/location'
include
Scenario
::
Actable
def
self
.
perform
(
*
args
)
...
...
qa/qa/git/repository/location.rb
deleted
100644 → 0
View file @
565fdd63
require
'uri'
require
'forwardable'
module
QA
module
Git
class
Repository
class
Location
extend
Forwardable
attr_reader
:git_uri
,
:uri
def_delegators
:@uri
,
:user
,
:host
,
:path
# 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
))
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
}
"
))
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
end
end
end
end
qa/spec/git/
repository/
location_spec.rb
→
qa/spec/git/location_spec.rb
View file @
59d49f70
describe
QA
::
Git
::
Repository
::
Location
do
describe
QA
::
Git
::
Location
do
describe
'.parse'
do
context
'when URI starts with ssh://'
do
context
'when URI has port'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment