Read about our upcoming Code of Conduct on this issue

Unverified Commit ccd842c3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Prevent post-receive error when push to project with dead forks



If project has open merge request from fork and this fork was removed
before merge request was closed it cause exception during push
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ccbd52f9f837
......@@ -411,7 +411,7 @@ def update_merge_requests(oldrev, newrev, ref, user)
mrs = self.merge_requests.opened.where(target_branch: branch_name).to_a
mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
mrs.uniq.each do |merge_request|
mrs.uniq.select(&:source_project).each do |merge_request|
MergeRequests::MergeService.new.execute(merge_request, user, nil)
end
......@@ -420,7 +420,7 @@ def update_merge_requests(oldrev, newrev, ref, user)
# Update code for merge requests between project and project fork
mrs += self.fork_merge_requests.opened.by_branch(branch_name).to_a
mrs.uniq.each do |merge_request|
mrs.uniq.select(&:source_project).each do |merge_request|
merge_request.reload_code
merge_request.mark_as_unchecked
end
......@@ -435,7 +435,7 @@ def comment_mr_with_commits(branch_name, commits, user)
mrs = self.origin_merge_requests.opened.where(source_branch: branch_name).to_a
mrs += self.fork_merge_requests.opened.where(source_branch: branch_name).to_a
mrs.uniq.each do |merge_request|
mrs.uniq.select(&:source_project).each do |merge_request|
Note.create_new_commits_note(merge_request, merge_request.project,
user, 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