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
branch = Gitlab::Git::Branch.find(self, branch_or_name)
if branch
root_ref_sha = commit(root_ref).sha
same_head = branch.target == root_ref_sha
@root_ref_sha ||= commit(root_ref).sha
same_head = branch.target == @root_ref_sha
merged =
if pre_loaded_merged_branches
pre_loaded_merged_branches.include?(branch.name)
else
ancestor?(branch.target, root_ref_sha)
ancestor?(branch.target, @root_ref_sha)
end
!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