diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-02 18:42:56 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-02 18:42:56 +0300 |
commit | 835cbc06d8d9c773a3b405eca81650378a8ccdcd (patch) | |
tree | f9f99c08e4cab4fbaf25448ed4adc3f3cfe42908 /app/services/merge_requests/refresh_service.rb | |
parent | 9211b541d3eaa60401f4ab6a5d264f9179ad4160 (diff) |
Reload mr code on force push too
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/merge_requests/refresh_service.rb')
-rw-r--r-- | app/services/merge_requests/refresh_service.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 1a1704aea77..baf0936cc3d 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -3,6 +3,7 @@ module MergeRequests def execute(oldrev, newrev, ref) return true unless ref =~ /heads/ + @oldrev, @newrev = oldrev, newrev @branch_name = ref.gsub("refs/heads/", "") @fork_merge_requests = @project.fork_merge_requests.opened @commits = @project.repository.commits_between(oldrev, newrev) @@ -35,6 +36,10 @@ module MergeRequests end end + def force_push? + Gitlab::ForcePushCheck.force_push?(@project, @oldrev, @newrev) + end + # 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 @@ -44,7 +49,7 @@ module MergeRequests merge_requests.each do |merge_request| - if merge_request.source_branch == @branch_name + if merge_request.source_branch == @branch_name || force_push? merge_request.reload_code merge_request.mark_as_unchecked else |