Commit 6d3eea7b authored by Brett Walker's avatar Brett Walker

if the branch/tag count is over a certain limit, don't execute

the long running git query
parent a11077e9
......@@ -56,8 +56,8 @@ class Projects::CommitController < Projects::ApplicationController
end
def branches
@branches = @project.repository.branch_names_contains(commit.id)
@tags = @project.repository.tag_names_contains(commit.id)
@branches = @project.repository.branch_names_contains(commit.id, 1000)
@tags = @project.repository.tag_names_contains(commit.id, 1000)
render layout: false
end
......
......@@ -715,12 +715,12 @@ class Repository
end
end
def branch_names_contains(sha)
refs_contains_sha('branch', sha)
def branch_names_contains(sha, limit = nil)
limit && branch_count > limit ? [] : refs_contains_sha('branch', sha)
end
def tag_names_contains(sha)
refs_contains_sha('tag', sha)
def tag_names_contains(sha, limit = nil)
limit && tag_count > limit ? [] : refs_contains_sha('tag', sha)
end
def local_branches
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment