summaryrefslogtreecommitdiff
path: root/app/controllers/projects/commits_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/commits_controller.rb')
-rw-r--r--app/controllers/projects/commits_controller.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb
index 04a88990bf4..1420b96840c 100644
--- a/app/controllers/projects/commits_controller.rb
+++ b/app/controllers/projects/commits_controller.rb
@@ -8,13 +8,22 @@ class Projects::CommitsController < Projects::ApplicationController
before_action :authorize_download_code!
def show
- @repo = @project.repository
@limit, @offset = (params[:limit] || 40).to_i, (params[:offset] || 0).to_i
+ search = params[:search]
+
+ @commits =
+ if search.present?
+ @repository.find_commits_by_message(search, @ref, @path, @limit, @offset).compact
+ else
+ @repository.commits(@ref, @path, @limit, @offset)
+ end
- @commits = @repo.commits(@ref, @path, @limit, @offset)
@note_counts = project.notes.where(commit_id: @commits.map(&:id)).
group(:commit_id).count
+ @merge_request = @project.merge_requests.opened.
+ find_by(source_project: @project, source_branch: @ref, target_branch: @repository.root_ref)
+
respond_to do |format|
format.html
format.json { pager_json("projects/commits/_commits", @commits.size) }