summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFlorent (HP) <baldinof@gmail.com>2015-08-09 20:31:50 +0200
committerFlorent (HP) <baldinof@gmail.com>2015-08-11 23:00:46 +0200
commit8adf6ba8f5bf9086ec3f9bb54ad801deb4d41924 (patch)
tree30ecdf365b62f85c0645d10502d55e05047f6548 /app
parentcb6ad67f52c9e849e0f8ca34b2fff47c585bd816 (diff)
downloadgitlab-ce-8adf6ba8f5bf9086ec3f9bb54ad801deb4d41924.tar.gz
Add merged label on branches page
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb11
-rw-r--r--app/views/projects/branches/_branch.html.haml5
2 files changed, 16 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 0a62980f93a..3bba3ca888a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -364,6 +364,17 @@ class Repository
@root_ref ||= raw_repository.root_ref
end
+ def merged_to_root_ref?(branch_name)
+ branch_commit = commit(branch_name)
+ root_ref_commit = commit(root_ref)
+
+ if branch_commit
+ rugged.merge_base(root_ref_commit.id, branch_commit.id) == branch_commit.id
+ else
+ nil
+ end
+ end
+
def search_files(query, ref)
offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 43412624da6..a693c4b282f 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -5,6 +5,11 @@
%strong.str-truncated= branch.name
- if branch.name == @repository.root_ref
%span.label.label-info default
+ - elsif @repository.merged_to_root_ref? branch.name
+ %span.label.label-primary.has_tooltip(title="Merged into #{@repository.root_ref}")
+ %i.fa.fa-check
+ merged
+
- if @project.protected_branch? branch.name
%span.label.label-success
%i.fa.fa-lock