diff options
-rw-r--r-- | app/controllers/ci/projects_controller.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 64d544acfd9..adb913a783f 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -14,9 +14,10 @@ module Ci def show @ref = params[:ref] - @commits = @project.commits.group(:sha).reverse_order + @commits = @project.commits.reverse_order if @ref - builds = @project.builds.where(ref: @ref).select(:commit_id).distinct + # unscope is required, because of default_scope defined in Ci::Build + builds = @project.builds.unscope(:select, :order).where(ref: @ref).select(:commit_id).distinct @commits = @commits.where(id: builds) end @commits = @commits.page(params[:page]).per(20) |