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
45c19a98
Commit
45c19a98
authored
May 15, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'omega-submodules' into 'master'
Omega submodules See merge request !10797
parents
cae08033
897a85a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+4
-0
changelogs/unreleased/omega-submodules.yml
changelogs/unreleased/omega-submodules.yml
+4
-0
spec/helpers/submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+13
-0
No files found.
app/helpers/submodule_helper.rb
View file @
45c19a98
...
@@ -7,6 +7,10 @@ module SubmoduleHelper
...
@@ -7,6 +7,10 @@ module SubmoduleHelper
def
submodule_links
(
submodule_item
,
ref
=
nil
,
repository
=
@repository
)
def
submodule_links
(
submodule_item
,
ref
=
nil
,
repository
=
@repository
)
url
=
repository
.
submodule_url_for
(
ref
,
submodule_item
.
path
)
url
=
repository
.
submodule_url_for
(
ref
,
submodule_item
.
path
)
if
url
==
'.'
||
url
==
'./'
url
=
File
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
@project
.
full_path
)
end
if
url
=~
/([^\/:]+)\/([^\/]+(?:\.git)?)\Z/
if
url
=~
/([^\/:]+)\/([^\/]+(?:\.git)?)\Z/
namespace
,
project
=
$1
,
$2
namespace
,
project
=
$1
,
$2
project
.
sub!
(
/\.git\z/
,
''
)
project
.
sub!
(
/\.git\z/
,
''
)
...
...
changelogs/unreleased/omega-submodules.yml
0 → 100644
View file @
45c19a98
---
title
:
'
Repository
browser:
handle
in-repository
submodule
urls'
merge_request
:
author
:
David Turner
spec/helpers/submodule_helper_spec.rb
View file @
45c19a98
...
@@ -81,6 +81,19 @@ describe SubmoduleHelper do
...
@@ -81,6 +81,19 @@ describe SubmoduleHelper do
end
end
end
end
context
'in-repository submodule'
do
let
(
:group
)
{
create
(
:group
,
name:
"Master Project"
,
path:
"master-project"
)
}
let
(
:project
)
{
create
(
:empty_project
,
group:
group
)
}
before
do
self
.
instance_variable_set
(
:@project
,
project
)
end
it
'in-repository'
do
stub_url
(
'./'
)
expect
(
submodule_links
(
submodule_item
)).
to
eq
([
"/master-project/
#{
project
.
path
}
"
,
"/master-project/
#{
project
.
path
}
/tree/hash"
])
end
end
context
'submodule on gitlab.com'
do
context
'submodule on gitlab.com'
do
it
'detects ssh'
do
it
'detects ssh'
do
stub_url
(
'git@gitlab.com:gitlab-org/gitlab-ce.git'
)
stub_url
(
'git@gitlab.com:gitlab-org/gitlab-ce.git'
)
...
...
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