Commit cb6f34e3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Implement update of ref when merge request code is reloaded

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