Prefer refs/keep-around over refs/merge-requests and only leave refs/merge-requests for open merge requests
This was brought up by @smcgivern in https://gitlab.com/gitlab-org/gitlab-ce/issues/36803#note_38214334
On a single repository, I think we could walk any non-keep-around refs, and create a corresponding keep-around ref for the SHA if needed. The advantage of the ref name containing the SHA is that we can ensure that we don't create duplicate refs pointing to the same SHA.
[...]
The problem is, how do we do that for all repositories on the system? Do we make it part of the housekeeping task, and then it will only happen for active repos? It only needs to be done once, if we stop writing the refs in the other format. Wdyt?
I think this is a good idea to reduce duplication. We should only use Git refs for keeping the source tree, not for keeping the SHA, which should be stored in database instead.
This is important because keeping minimum refs would make Git run faster and we could reduce the size of repository easier.