Clean up old MR versions keep around refs
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=383032) </details> <!--IssueSummary end--> ## Background As of this writing (2022-11-17), we are keeping keep-around refs for each MR diff version (via `MergeRequestDiff#keep_around_commits`). We do this to ensure that diff notes and commits that are dangling after a rebase/force-push will still be viewable (https://gitlab.com/gitlab-org/gitlab-foss/-/issues/13524). Having these keep-around refs increases the number of refs in repositories and affects Git performance. ## Proposal Clean up old (need to determine the threshold for this) MR versions' keep-around refs. We need to ensure that displaying diff notes will degrade gracefully instead of erroring out. Commits that aren't kept around will return a 404 response. One idea shared by @pks-t is to create revisions of an MR in `refs/merge-requests/v$revision` instead of as a keep-around ref. This allows to clearly scope revisions to MRs and potentially cleanup of those refs at a later point.
issue