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
3d2aaa16
Commit
3d2aaa16
authored
Jan 19, 2015
by
Headless
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show diff in submodules
parent
2fba3189
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
11 deletions
+21
-11
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+15
-0
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+2
-2
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+3
-0
app/views/projects/tree/_submodule_item.html.haml
app/views/projects/tree/_submodule_item.html.haml
+1
-9
No files found.
app/helpers/diff_helper.rb
View file @
3d2aaa16
...
...
@@ -135,4 +135,19 @@ module DiffHelper
'Side-by-side'
end
end
def
submodule_link
(
blob
,
ref
)
tree
,
commit
=
submodule_links
(
blob
,
ref
)
commit_id
=
if
commit
.
nil?
blob
.
id
[
0
..
10
]
else
link_to
"
#{
blob
.
id
[
0
..
10
]
}
"
,
commit
end
[
content_tag
(
:span
,
link_to
(
truncate
(
blob
.
name
,
length:
40
),
tree
)),
'@'
,
content_tag
(
:span
,
commit_id
,
class:
'monospace'
),
].
join
(
' '
).
html_safe
end
end
app/helpers/submodule_helper.rb
View file @
3d2aaa16
...
...
@@ -2,8 +2,8 @@ module SubmoduleHelper
include
Gitlab
::
ShellAdapter
# links to files listing for submodule if submodule is a project on this server
def
submodule_links
(
submodule_item
)
url
=
@repository
.
submodule_url_for
(
@
ref
,
submodule_item
.
path
)
def
submodule_links
(
submodule_item
,
ref
=
nil
)
url
=
@repository
.
submodule_url_for
(
ref
,
submodule_item
.
path
)
return
url
,
nil
unless
url
=~
/([^\/:]+\/[^\/]+\.git)\Z/
...
...
app/views/projects/diffs/_file.html.haml
View file @
3d2aaa16
...
...
@@ -9,6 +9,9 @@
.diff-btn-group
-
if
@commit
.
parent_ids
.
present?
=
view_file_btn
(
@commit
.
parent_id
,
diff_file
,
project
)
-
elsif
diff_file
.
diff
.
submodule?
-
submodule_item
=
project
.
repository
.
blob_at
(
@commit
.
id
,
diff_file
.
file_path
)
=
submodule_link
(
submodule_item
,
@commit
.
id
)
-
else
-
if
diff_file
.
renamed_file
%span
=
"
#{
diff_file
.
old_path
}
renamed to
#{
diff_file
.
new_path
}
"
...
...
app/views/projects/tree/_submodule_item.html.haml
View file @
3d2aaa16
-
tree
,
commit
=
submodule_links
(
submodule_item
)
%tr
{
class:
"tree-item"
}
%td
.tree-item-file-name
%i
.fa.fa-archive
%span
=
link_to
truncate
(
submodule_item
.
name
,
length:
40
),
tree
@
%span
.monospace
-
if
commit
.
nil?
#{
truncate_sha
(
submodule_item
.
id
)
}
-
else
=
link_to
"
#{
truncate_sha
(
submodule_item
.
id
)
}
"
,
commit
=
submodule_link
(
submodule_item
,
@ref
)
%td
%td
.hidden-xs
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