Skip to content

Remove stale merge request refs

Problem to solve

Every merge request created results in up to two new refs/merge-requests (refs/merge-requests/<id>/head and refs/merge-request/<id>/merge) being created, and these appear to never be deleted. This results in all these refs being transferred in every push. Even a tiny 1 line change must transfer all this data, making Git very slow.

For example:

  • www-gitlab-com has 285,000 refs, of which 28% are refs/merge-requests
    • total refs transferred is 25MB uncompressed, and 7MB compressed.
  • gitlab has 108,000 refs, of which 46% are ref/merge-requests
    • total refs transferred is 9.3MB uncompressed, and 2.8MB compressed.

Further details

Proposal

Merge request refs should be expired when they have been merged or closed for more than 14 days.

These does not mean the data will be deleted. A refs/keep-around can be created. These are hidden, and therefore excluded from ref advertisement. They will not be referenced on push/pull and should therefore improve performance.

Edited by Daniel Gruesso