summaryrefslogtreecommitdiff
path: root/app/controllers/projects/branches_controller.rb
diff options
context:
space:
mode:
authorJeff Stubler <brunsa2@gmail.com>2015-07-20 20:34:19 -0500
committerJeff Stubler <brunsa2@gmail.com>2015-11-01 11:38:00 -0600
commitc843722de2d778b6ec8fef0656797fd5a8074666 (patch)
tree75040853228588298e29d91b8ce606861f2bb468 /app/controllers/projects/branches_controller.rb
parent8f75200d466d41707f3b1ca12ca4244cfa2e2e7b (diff)
downloadgitlab-ce-c843722de2d778b6ec8fef0656797fd5a8074666.tar.gz
Add graphs showing commits ahead and behind default to branches page
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r--app/controllers/projects/branches_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 3ac0a75fa70..c3cd7642dd2 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -9,6 +9,12 @@ 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