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
Tatuya Kamada
gitlab-ce
Commits
2ceef769
Commit
2ceef769
authored
Apr 06, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
7ae488ed
2f945ac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+16
-0
No files found.
app/helpers/submodule_helper.rb
100644 → 100755
View file @
2ceef769
...
...
@@ -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,22 @@ module SubmoduleHelper
url
==
gitlab_shell
.
url_to_repo
(
project
)
end
def
relative_self_url?
(
url
)
# (./)?(../repo.git) || (./)?(../../project/repo.git) )
url
=~
/^((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\Z/
||
url
=~
/^((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.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
=
url
[
/([^\/]*\/[^\/]*)\.git/
,
1
]
else
base
=
[
@project
.
group
.
path
,
'/'
,
url
[
/([^\/]*)\.git/
,
1
]
].
join
(
''
)
end
return
project_path
(
base
),
project_tree_path
(
base
,
commit
)
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