Commit cb6f34e3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Implement update of ref when merge request code is reloaded

parent 2a6f522c
......@@ -160,9 +160,17 @@ class MergeRequestDiff < ActiveRecord::Base
private
def compare_result
@compare_result ||=
begin
source_sha = merge_request.source_project.commit(source_branch).sha
@compare_result ||= CompareService.new.execute(
merge_request.target_project.repository.fetch_ref(
merge_request.source_project.repository.path_to_repo,
"refs/heads/#{merge_request.source_branch}",
"refs/merge-requests/#{merge_request.id}/head"
)
CompareService.new.execute(
merge_request.author,
merge_request.target_project,
source_sha,
......@@ -170,4 +178,5 @@ class MergeRequestDiff < ActiveRecord::Base
merge_request.target_branch,
)
end
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