Clean up invalid keep-around refs when performing housekeeping
We used to corrupt
keep-around refs when creating them using
rugged. This ensures we clean up any refs git won't understand
repairing them if possible.
When the ref contents is blank, invalid or a "blank"-sha, we remove the ref and recreate it based on it's filename if the filename was a valid SHA.
Required for https://gitlab.com/gitlab-org/gitlab-ce/issues/44431