Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e5d491b7
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5d491b7
编写于
1月 21, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7389 from skv-headless/show-submodules-in-diff
show diff in submodules
上级
0c4bb849
3d2aaa16
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
11 deletion
+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
未找到文件。
app/helpers/diff_helper.rb
浏览文件 @
e5d491b7
...
...
@@ -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
浏览文件 @
e5d491b7
...
...
@@ -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
浏览文件 @
e5d491b7
...
...
@@ -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
浏览文件 @
e5d491b7
-
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录