BigW Consortium Gitlab

Commit c008a1a9 by Douwe Maan

Make Compare#diffs diff_options a regular argument

parent c86c1905
......@@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
def diff_for_path
return render_404 unless @compare
render_diff_for_path(@compare.diffs(diff_options: diff_options))
render_diff_for_path(@compare.diffs(diff_options))
end
def create
......@@ -45,7 +45,7 @@ class Projects::CompareController < Projects::ApplicationController
@commit = @compare.commit
@base_commit = @compare.base_commit
@diffs = @compare.diffs(diff_options: diff_options)
@diffs = @compare.diffs(diff_options)
@diff_notes_disabled = true
@grouped_diff_discussions = {}
......
......@@ -49,7 +49,7 @@ class Compare
@compare.diffs(*args)
end
def diffs(diff_options:)
def diffs(diff_options = nil)
Gitlab::Diff::FileCollection::Compare.new(self,
project: project,
diff_options: diff_options,
......
......@@ -170,7 +170,7 @@ class MergeRequest < ActiveRecord::Base
def diffs(diff_options = nil)
if self.compare
self.compare.diffs(diff_options: diff_options)
self.compare.diffs(diff_options)
else
Gitlab::Diff::FileCollection::MergeRequest.new(self, diff_options: diff_options)
end
......
......@@ -42,7 +42,7 @@ module Gitlab
return unless compare
# This diff is more moderated in number of files and lines
@diffs ||= compare.diffs(diff_options: { max_files: 30, max_lines: 5000, no_collapse: true }).diff_files
@diffs ||= compare.diffs(max_files: 30, max_lines: 5000, no_collapse: true).diff_files
end
def diffs_count
......
......@@ -171,7 +171,7 @@ describe MergeRequest, models: true do
it 'delegates to the compare object' do
merge_request.compare = double(:compare)
expect(merge_request.compare).to receive(:diffs).with(diff_options: options)
expect(merge_request.compare).to receive(:diffs).with(options)
merge_request.diffs(options)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment