compare_controller.rb 697 字节
Newer Older
1
class Projects::CompareController < Projects::ApplicationController
2
  # Authorize
3 4
  before_action :require_non_empty_project
  before_action :authorize_download_code!
5

6 7 8
  def index
  end

9
  def show
10 11
    base_ref = params[:from]
    head_ref = params[:to]
12

13 14 15
    compare_result = CompareService.new.execute(
      current_user,
      @project,
16
      head_ref,
17
      @project,
18
      base_ref
19 20 21 22 23 24
    )

    @commits = compare_result.commits
    @diffs = compare_result.diffs
    @commit = @commits.last
    @line_notes = []
25
  end
26 27

  def create
V
Vinnie Okada 已提交
28 29
    redirect_to namespace_project_compare_path(@project.namespace, @project,
                                               params[:from], params[:to])
30
  end
31
end