Skip to content
代码片段 群组 项目
提交 cd814fbc 编辑于 作者: Ahmad Sherif's avatar Ahmad Sherif
浏览文件

Eliminate unneeded calls to Repository#blob_at when listing commits with no path

上级 83bbca26
No related branches found
No related tags found
无相关合并请求
...@@ -120,6 +120,7 @@ v 8.11.0 (unreleased) ...@@ -120,6 +120,7 @@ v 8.11.0 (unreleased)
- Fix a memory leak caused by Banzai::Filter::SanitizationFilter - Fix a memory leak caused by Banzai::Filter::SanitizationFilter
- Speed up todos queries by limiting the projects set we join with - Speed up todos queries by limiting the projects set we join with
- Ensure file editing in UI does not overwrite commited changes without warning user - Ensure file editing in UI does not overwrite commited changes without warning user
- Eliminate unneeded calls to Repository#blob_at when listing commits with no path
v 8.10.6 v 8.10.6
- Upgrade Rails to 4.2.7.1 for security fixes. !5781 - Upgrade Rails to 4.2.7.1 for security fixes. !5781
......
...@@ -98,28 +98,31 @@ def commit_tags_links(project, tags) ...@@ -98,28 +98,31 @@ def commit_tags_links(project, tags)
end end
def link_to_browse_code(project, commit) def link_to_browse_code(project, commit)
if current_controller?(:projects, :commits) if @path.blank?
if @repo.blob_at(commit.id, @path) return link_to(
return link_to( "Browse Files",
"Browse File", namespace_project_tree_path(project.namespace, project, commit),
namespace_project_blob_path(project.namespace, project, class: "btn btn-default"
tree_join(commit.id, @path)), )
class: "btn btn-default" end
)
elsif @path.present? return unless current_controller?(:projects, :commits)
return link_to(
"Browse Directory", if @repo.blob_at(commit.id, @path)
namespace_project_tree_path(project.namespace, project, return link_to(
tree_join(commit.id, @path)), "Browse File",
class: "btn btn-default" namespace_project_blob_path(project.namespace, project,
) tree_join(commit.id, @path)),
end class: "btn btn-default"
)
elsif @path.present?
return link_to(
"Browse Directory",
namespace_project_tree_path(project.namespace, project,
tree_join(commit.id, @path)),
class: "btn btn-default"
)
end end
link_to(
"Browse Files",
namespace_project_tree_path(project.namespace, project, commit),
class: "btn btn-default"
)
end end
def revert_commit_link(commit, continue_to_path, btn_class: nil, has_tooltip: true) def revert_commit_link(commit, continue_to_path, btn_class: nil, has_tooltip: true)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册