Cache the root ref SHA in an instance variable in Repository#merged_to_root_ref?
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
b20984dea2
commit
ad937d270c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue