Clean up all invalid refs in `refs/`
In https://gitlab.com/gitlab-org/gitlab-ce/issues/44431 we avoid creating invalid refs when calling the WriteRef
RPC.
Most reports of invalid refs are reported in refs/keep-around
, we can relatively safely delete or repair those, and will deal with that as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/44431.
But there might be other invalid refs in refs/
for example from the rarely used CreateBranch
RPC.
As mentioned in https://gitlab.com/gitlab-org/gitlab-ce/issues/44431#note_107969067.
We should figure out a way to deal with these refs. We should remove them as they are corrupted, but they could be user created, so we probably need to log them so we can figure out a way back if needed.