diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-05 15:44:22 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-05 15:44:22 +0000 |
commit | 07c39c9976bcceca94b11525917cd27db8088b2f (patch) | |
tree | 332c4bb637056e04cb54edfa75396e2a347b098b /app/controllers | |
parent | 7c3c901ada6fc4a6d2d3ce7a2cf8188cf6615008 (diff) | |
parent | 2e8ec7e7204b2876218db34439584204b1062265 (diff) | |
download | gitlab-ce-07c39c9976bcceca94b11525917cd27db8088b2f.tar.gz |
Merge branch 'brunsa2/gitlab-ce-diverging-branch-graphs' into 'master'
Add graphs of commits ahead/behind default branch (by @brunsa2)
Replaces https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1716
See merge request !2301
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 3c2849a7601..4db3b3bf23d 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -9,6 +9,11 @@ class Projects::BranchesController < Projects::ApplicationController @sort = params[:sort] || 'name' @branches = @repository.branches_sorted_by(@sort) @branches = Kaminari.paginate_array(@branches).page(params[:page]).per(PER_PAGE) + + @max_commits = @branches.reduce(0) do |memo, branch| + diverging_commit_counts = repository.diverging_commit_counts(branch) + [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max + end end def recent |