Rebase button seems unnecessarily slow

Summary

Pressing the rebase button on a merge request takes at least 10 seconds, but usually minutes to complete on our instance. That seems longer than it should be.

Steps to reproduce

  1. Create a repo on Gitlab.com
  2. Add a commit on master
  3. Create a merge request from a different branch to master
  4. Add another (non-conflicting) commit on master
  5. Press the rebase button on the merge request page.

What is the current bug behavior?

The rebase will be in progress for >10 seconds. For larger repos it will take minutes.

What is the expected correct behavior?

As the same operation (git fetch origin && git rebase origin/master) takes around a second locally (for larger repos as well), I would expect this to take no more than 2-3 seconds.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com.

Possible fixes

It seems that this task is cloning the repo from scratch. That sounds like unnecessary work — maybe get rid of that somehow?

Edited by Coung Ngo