Commit 58bfcb0a authored by Paco Guzman's avatar Paco Guzman

Use raw_diffs for internal git diff

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5401
parent 0c33c08e
......@@ -32,7 +32,7 @@ module Gitlab
diffable = [@merge_request.compare, @merge_request.merge_request_diff].compact
return [] if diffable.empty?
compare_diffs = diffable.first.diffs
compare_diffs = diffable.first.raw_diffs
return [] unless compare_diffs.present?
......
......@@ -143,7 +143,7 @@ module Gitlab
commits(@oldrev).each do |commit|
next if commit_from_annex_sync?(commit.safe_message)
commit.diffs.each do |diff|
commit.raw_diffs.each do |diff|
path = diff.new_path || diff.old_path
lock_info = project.find_path_lock(path)
......@@ -195,7 +195,7 @@ module Gitlab
def check_commit_diff(commit, push_rule)
if push_rule.file_name_regex.present?
commit.diffs.each do |diff|
commit.raw_diffs.each do |diff|
if (diff.renamed_file || diff.new_file) && diff.new_path =~ Regexp.new(push_rule.file_name_regex)
return "File name #{diff.new_path.inspect} is prohibited by the pattern '#{push_rule.file_name_regex}'"
end
......@@ -203,7 +203,7 @@ module Gitlab
end
if push_rule.max_file_size > 0
commit.diffs.each do |diff|
commit.raw_diffs.each do |diff|
next if diff.deleted_file
blob = project.repository.blob_at(commit.id, diff.new_path)
......
......@@ -170,7 +170,7 @@ module Gitlab
def check_commit_diff(commit, push_rule)
if push_rule.file_name_regex.present?
commit.diffs.each do |diff|
commit.raw_diffs.each do |diff|
if (diff.renamed_file || diff.new_file) && diff.new_path =~ Regexp.new(push_rule.file_name_regex)
return build_status_object(false, "File name #{diff.new_path.inspect} is prohibited by the pattern '#{push_rule.file_name_regex}'")
end
......@@ -178,7 +178,7 @@ module Gitlab
end
if push_rule.max_file_size > 0
commit.diffs.each do |diff|
commit.raw_diffs.each do |diff|
next if diff.deleted_file
blob = project.repository.blob_at(commit.id, diff.new_path)
......
......@@ -22,7 +22,7 @@ describe Gitlab::AuthorityAnalyzer, lib: true do
let(:approvers) { Gitlab::AuthorityAnalyzer.new(merge_request).calculate(number_of_approvers) }
before do
merge_request.compare = double(:compare, diffs: files)
merge_request.compare = double(:compare, raw_diffs: files)
allow(merge_request.target_project.repository).to receive(:commits).and_return(commits)
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