debian-mirror-gitlab/app/controllers/projects/commits_controller.rb

41 lines
1.1 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require "base64"
class Projects::CommitsController < Projects::ApplicationController
include ExtractsPath
2015-09-11 14:41:01 +05:30
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
2014-09-02 18:07:02 +05:30
def show
@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
2016-06-02 11:05:42 +05:30
@repository.commits(@ref, path: @path, limit: @limit, offset: @offset)
end
2014-09-02 18:07:02 +05:30
2015-11-26 14:37:03 +05:30
@note_counts = project.notes.where(commit_id: @commits.map(&:id)).
2015-04-26 12:48:37 +05:30
group(:commit_id).count
2014-09-02 18:07:02 +05:30
2016-04-02 18:10:28 +05:30
@merge_request = @project.merge_requests.opened.
find_by(source_project: @project, source_branch: @ref, target_branch: @repository.root_ref)
2014-09-02 18:07:02 +05:30
respond_to do |format|
2015-04-26 12:48:37 +05:30
format.html
2014-09-02 18:07:02 +05:30
format.atom { render layout: false }
2016-11-24 13:41:30 +05:30
format.json do
pager_json(
'projects/commits/_commits',
@commits.size,
project: @project,
ref: @ref)
end
2014-09-02 18:07:02 +05:30
end
end
end