Skip to content

Fix extra merge request versions created from forked merge requests

Stan Hu requested to merge sh-fix-issue-53153 into master

When a forked merge request was created with the same branch name as the target name, MergeRequests::RefreshService would always create a new diff even though nothing had changed. For example, on GitLab.com:

  1. There were a number of merge requests in the gitlab-ce and www-gitlab-com projects that had old merge requests from the community.
  2. These merge requests originated from forked projects and used the source branch master.
  3. When someone pushed to master in the main repository, MergeRequests::RefreshService would see that master matched the merge requests in question and generated a new diff.
  4. This led to an explosion of merge request diffs and slowed down the "Changes" tab considerably.

This change alters MergeRequests::RefreshService so that it will only refresh the diff if the merge request's source project and branch match. Otherwise, the refresh will only happen if a pushed commit contains a commit relevant to the existing merge request.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53153

Edited by Stan Hu

Merge request reports

Loading