Commit ad937d27 authored by Rémy Coutable's avatar Rémy Coutable

Cache the root ref SHA in an instance variable in Repository#merged_to_root_ref?

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent b20984de
...@@ -906,13 +906,13 @@ class Repository ...@@ -906,13 +906,13 @@ class Repository
branch = Gitlab::Git::Branch.find(self, branch_or_name) branch = Gitlab::Git::Branch.find(self, branch_or_name)
if branch if branch
root_ref_sha = commit(root_ref).sha @root_ref_sha ||= commit(root_ref).sha
same_head = branch.target == root_ref_sha same_head = branch.target == @root_ref_sha
merged = merged =
if pre_loaded_merged_branches if pre_loaded_merged_branches
pre_loaded_merged_branches.include?(branch.name) pre_loaded_merged_branches.include?(branch.name)
else else
ancestor?(branch.target, root_ref_sha) ancestor?(branch.target, @root_ref_sha)
end end
!same_head && merged !same_head && merged
......
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