diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-03 09:32:01 -0700 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-08-03 09:32:01 -0700 |
commit | c008a1a9674f7c01b4504e22ed414b07eff05385 (patch) | |
tree | daf83460eaf0f1a470a8f07b0b132c3cf12a566b | |
parent | c86c1905b5574cac234315598d8d715fcaee3ea7 (diff) | |
download | gitlab-ce-c008a1a9674f7c01b4504e22ed414b07eff05385.tar.gz |
Make Compare#diffs diff_options a regular argument
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 4 | ||||
-rw-r--r-- | app/models/compare.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/email/message/repository_push.rb | 2 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 4a42a7d091b..bee3d56076c 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -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 = {} diff --git a/app/models/compare.rb b/app/models/compare.rb index 98c042f3809..4856510f526 100644 --- a/app/models/compare.rb +++ b/app/models/compare.rb @@ -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, diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 009262d6b48..c4761fac2fb 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb index 62d29387d60..0e3b65fceb4 100644 --- a/lib/gitlab/email/message/repository_push.rb +++ b/lib/gitlab/email/message/repository_push.rb @@ -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 diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 152e0cce5ad..e43008c1a4d 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -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 |