commits_controller.rb 677 字节
Newer Older
G
gitlabhq 已提交
1 2
require "base64"

3
class Projects::CommitsController < Projects::ApplicationController
4 5
  include ExtractsPath

6
  before_filter :require_non_empty_project
7
  before_filter :assign_ref_vars
8
  before_filter :authorize_download_code!
G
gitlabhq 已提交
9

10
  def show
D
Dmitriy Zaporozhets 已提交
11
    @repo = @project.repository
12
    @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
13

D
Dmitriy Zaporozhets 已提交
14
    @commits = @repo.commits(@ref, @path, @limit, @offset)
S
skv 已提交
15
    @note_counts = Note.where(commit_id: @commits.map(&:id)).
16
      group(:commit_id).count
G
gitlabhq 已提交
17 18

    respond_to do |format|
19
      format.html
20
      format.json { pager_json("projects/commits/_commits", @commits.size) }
21
      format.atom { render layout: false }
G
gitlabhq 已提交
22 23 24
    end
  end
end