Skip to content
Snippets Groups Projects
Verified Commit ad937d27 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment