mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
Now we apply syntax highlighting to the whole old and new files. This basically help us to highlight adequately multiline content.
35 lines
1.0 KiB
Ruby
35 lines
1.0 KiB
Ruby
require 'addressable/uri'
|
|
|
|
class Projects::CompareController < Projects::ApplicationController
|
|
# Authorize
|
|
before_action :require_non_empty_project
|
|
before_action :authorize_download_code!
|
|
|
|
def index
|
|
@ref = Addressable::URI.unescape(params[:to])
|
|
end
|
|
|
|
def show
|
|
base_ref = Addressable::URI.unescape(params[:from])
|
|
@ref = head_ref = Addressable::URI.unescape(params[:to])
|
|
diff_options = { ignore_whitespace_change: true } if params[:w] == '1'
|
|
|
|
compare_result = CompareService.new.
|
|
execute(@project, head_ref, @project, base_ref, diff_options)
|
|
|
|
if compare_result
|
|
@commits = Commit.decorate(compare_result.commits, @project)
|
|
@diffs = compare_result.diffs
|
|
@diff_refs = [base_ref, head_ref]
|
|
@commit = @project.commit(head_ref)
|
|
@first_commit = @project.commit(base_ref)
|
|
@line_notes = []
|
|
end
|
|
end
|
|
|
|
def create
|
|
redirect_to namespace_project_compare_path(@project.namespace, @project,
|
|
params[:from], params[:to])
|
|
end
|
|
end
|