From 22775c596f9f8be79ec7599b561aa0ccb40bdc42 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 15 Oct 2015 01:57:45 -0700 Subject: [PATCH] Preserve target branch --- app/services/merge_requests/refresh_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 802d02b0790..8139aef2bb9 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -55,7 +55,11 @@ module MergeRequests # Refresh merge request diff if we push to source or target branch of merge request # Note: we should update merge requests from forks too def reload_merge_requests - @merge_requests.each do |merge_request| + merge_requests = @project.merge_requests.opened.by_branch(@branch_name).to_a + merge_requests += @fork_merge_requests.by_branch(@branch_name).to_a + merge_requests = filter_merge_requests(merge_requests) + + merge_requests.each do |merge_request| if merge_request.source_branch == @branch_name || force_push? merge_request.reload_code