summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-06 13:06:25 +0100
committerDouwe Maan <douwe@gitlab.com>2016-01-06 13:06:25 +0100
commit639d428046938b5976f87726746d862441ee7036 (patch)
treed5db554d7efec312ccc6b7994f7dfb5d9ed23bf4 /app/controllers
parent384445eca6249363c0da6d8b96e7ee030dc6fab3 (diff)
parent95b1adb3394851132ea7ecb3104e9a857bdad82f (diff)
downloadgitlab-ce-more-opengraph.tar.gz
Merge branch 'master' into more-opengraphmore-opengraph
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/branches_controller.rb5
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