diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-11-18 02:13:45 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-11-23 18:26:41 +0800 |
commit | 7df1cb528e5d977f5f18b1c82433b3c76220d6db (patch) | |
tree | 1a0910dfdf21cf1c90192c8295c41ebc57b58376 /app | |
parent | 3e558d8dbdbf39a0241b1e72ee494362624ace38 (diff) | |
download | gitlab-ce-7df1cb528e5d977f5f18b1c82433b3c76220d6db.tar.gz |
Move identical merged branch check to merged_branch_names
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 10 | ||||
-rw-r--r-- | app/views/projects/branches/index.html.haml | 2 |
2 files changed, 3 insertions, 9 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 2bf21cbdcc4..d4ffd7bfc07 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -909,19 +909,13 @@ class Repository end end - def merged_to_root_ref?(branch_or_name, pre_loaded_merged_branches = nil) + def merged_to_root_ref?(branch_or_name) 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 - merged = - if pre_loaded_merged_branches - pre_loaded_merged_branches.include?(branch.name) - else - ancestor?(branch.target, @root_ref_sha) - end - + merged = ancestor?(branch.target, @root_ref_sha) !same_head && merged else nil diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index aade310236e..fb770764364 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -38,7 +38,7 @@ - if @branches.any? %ul.content-list.all-branches - @branches.each do |branch| - = render "projects/branches/branch", branch: branch, merged: @repository.merged_to_root_ref?(branch, @merged_branch_names) + = render "projects/branches/branch", branch: branch, merged: @merged_branch_names.include?(branch.name) = paginate @branches, theme: 'gitlab' - else .nothing-here-block |