BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
58722738
Commit
58722738
authored
Jun 05, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dz-fix-submodule-subgroup' into 'master'
Fix submodule link to then project under subgroup Closes gitlab-ee#2411 See merge request !11906
parents
6be3f910
9c2ca7aa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
submodule_helper.rb
app/helpers/submodule_helper.rb
+11
-0
dz-fix-submodule-subgroup.yml
changelogs/unreleased/dz-fix-submodule-subgroup.yml
+4
-0
submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+8
-0
No files found.
app/helpers/submodule_helper.rb
View file @
58722738
...
...
@@ -13,6 +13,17 @@ module SubmoduleHelper
if
url
=~
/([^\/:]+)\/([^\/]+(?:\.git)?)\Z/
namespace
,
project
=
$1
,
$2
gitlab_hosts
=
[
Gitlab
.
config
.
gitlab
.
url
,
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
]
gitlab_hosts
.
each
do
|
host
|
if
url
.
start_with?
(
host
)
namespace
,
_
,
project
=
url
.
sub
(
host
,
''
).
rpartition
(
'/'
)
break
end
end
namespace
.
sub!
(
/\A\//
,
''
)
project
.
rstrip!
project
.
sub!
(
/\.git\z/
,
''
)
...
...
changelogs/unreleased/dz-fix-submodule-subgroup.yml
0 → 100644
View file @
58722738
---
title
:
Fix submodule link to then project under subgroup
merge_request
:
11906
author
:
spec/helpers/submodule_helper_spec.rb
View file @
58722738
...
...
@@ -52,6 +52,14 @@ describe SubmoduleHelper do
stub_url
([
'http://'
,
config
.
host
,
'/gitlab/root/gitlab-org/gitlab-ce.git'
].
join
(
''
))
expect
(
submodule_links
(
submodule_item
)).
to
eq
([
namespace_project_path
(
'gitlab-org'
,
'gitlab-ce'
),
namespace_project_tree_path
(
'gitlab-org'
,
'gitlab-ce'
,
'hash'
)])
end
it
'works with subgroups'
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:port
).
and_return
(
80
)
# set this just to be sure
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:relative_url_root
).
and_return
(
'/gitlab/root'
)
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:url
).
and_return
(
Settings
.
send
(
:build_gitlab_url
))
stub_url
([
'http://'
,
config
.
host
,
'/gitlab/root/gitlab-org/sub/gitlab-ce.git'
].
join
(
''
))
expect
(
submodule_links
(
submodule_item
)).
to
eq
([
namespace_project_path
(
'gitlab-org/sub'
,
'gitlab-ce'
),
namespace_project_tree_path
(
'gitlab-org/sub'
,
'gitlab-ce'
,
'hash'
)])
end
end
context
'submodule on github.com'
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