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
fe8c9021
Commit
fe8c9021
authored
Feb 25, 2014
by
Timm Drevensek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for relative submodules
parent
1c7aecc8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
CHANGELOG
CHANGELOG
+1
-0
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+17
-0
No files found.
CHANGELOG
View file @
fe8c9021
...
...
@@ -3,6 +3,7 @@ v 6.7.0
- Add edit file button to MergeRequest diff
- Public groups (Jason Hollingsworth)
- Cleaner headers in Notification Emails (Pierre de La Morinerie)
- Add support for relative submodules
v 6.6.2
- Fix 500 error on branch/tag create or remove via UI
...
...
app/helpers/submodule_helper.rb
100644 → 100755
View file @
fe8c9021
...
...
@@ -12,6 +12,8 @@ module SubmoduleHelper
if
self_url?
(
url
,
project
)
return
project_path
(
project
),
project_tree_path
(
project
,
submodule_item
.
id
)
elsif
relative_self_url?
(
url
)
relative_self_links
(
url
,
submodule_item
.
id
)
elsif
github_dot_com_url?
(
url
)
standard_links
(
'github.com'
,
project
,
submodule_item
.
id
)
elsif
gitlab_dot_com_url?
(
url
)
...
...
@@ -36,8 +38,23 @@ module SubmoduleHelper
url
==
gitlab_shell
.
url_to_repo
(
project
)
end
def
relative_self_url?
(
url
)
# (./)? ( (../repo.git) | (../../project/repo.git) )
url
=~
/(^((\.\/)?(((\.\.)\/)|((\.\.)\/(\.\.)\/.*\/)))[^\.\/]*\.git)\Z/
end
def
standard_links
(
host
,
project
,
commit
)
base
=
[
'https://'
,
host
,
'/'
,
project
].
join
(
''
)
return
base
,
[
base
,
'/tree/'
,
commit
].
join
(
''
)
end
def
relative_self_links
(
url
,
commit
)
if
url
.
scan
(
/(\.\.)/
).
size
==
2
base
=
[
Gitlab
.
config
.
gitlab
.
url
,
'/'
,
url
[
/.*\/(.*)\/.*\.git/
,
1
]
].
join
(
''
)
else
base
=
[
Gitlab
.
config
.
gitlab
.
url
,
'/'
,
@project
.
group
.
path
].
join
(
''
)
end
base
=
[
base
,
'/'
,
url
[
/.*\/(.*)\.git/
,
1
]
].
join
(
''
)
return
base
,
[
base
,
'/tree/'
,
commit
].
join
(
''
)
end
end
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