Commit c008a1a9 authored by Douwe Maan's avatar Douwe Maan

Make Compare#diffs diff_options a regular argument

parent c86c1905
...@@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
def diff_for_path def diff_for_path
return render_404 unless @compare return render_404 unless @compare
render_diff_for_path(@compare.diffs(diff_options: diff_options)) render_diff_for_path(@compare.diffs(diff_options))
end end
def create def create
...@@ -45,7 +45,7 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -45,7 +45,7 @@ class Projects::CompareController < Projects::ApplicationController
@commit = @compare.commit @commit = @compare.commit
@base_commit = @compare.base_commit @base_commit = @compare.base_commit
@diffs = @compare.diffs(diff_options: diff_options) @diffs = @compare.diffs(diff_options)
@diff_notes_disabled = true @diff_notes_disabled = true
@grouped_diff_discussions = {} @grouped_diff_discussions = {}
......
...@@ -49,7 +49,7 @@ class Compare ...@@ -49,7 +49,7 @@ class Compare
@compare.diffs(*args) @compare.diffs(*args)
end end
def diffs(diff_options:) def diffs(diff_options = nil)
Gitlab::Diff::FileCollection::Compare.new(self, Gitlab::Diff::FileCollection::Compare.new(self,
project: project, project: project,
diff_options: diff_options, diff_options: diff_options,
......
...@@ -170,7 +170,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -170,7 +170,7 @@ class MergeRequest < ActiveRecord::Base
def diffs(diff_options = nil) def diffs(diff_options = nil)
if self.compare if self.compare
self.compare.diffs(diff_options: diff_options) self.compare.diffs(diff_options)
else else
Gitlab::Diff::FileCollection::MergeRequest.new(self, diff_options: diff_options) Gitlab::Diff::FileCollection::MergeRequest.new(self, diff_options: diff_options)
end end
......
...@@ -42,7 +42,7 @@ module Gitlab ...@@ -42,7 +42,7 @@ module Gitlab
return unless compare return unless compare
# This diff is more moderated in number of files and lines # 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 end
def diffs_count def diffs_count
......
...@@ -171,7 +171,7 @@ describe MergeRequest, models: true do ...@@ -171,7 +171,7 @@ describe MergeRequest, models: true do
it 'delegates to the compare object' do it 'delegates to the compare object' do
merge_request.compare = double(:compare) 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) merge_request.diffs(options)
end 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