Gracefully handle corrupted/invalid repo HEAD in (admin) UI
Summary
We recently came across a project repo with empty HEAD reference and Web UI (Even admin UI), was showing 500s and making it difficult to obtain further information about the project from admin interface.
Originating production issue: gitlab-com/gl-infra/production#17129 (closed)
Thread with additional information: gitlab-com/gl-infra/production#17129 (comment 1649210825)
Impact
Web UI shows 500 for projects with invalid HEAD reference.
Recommendation
UI should handle such cases graciously with a more controlled error, to atleast show other information about the project. The project view in admin UI also shows 500s.
Verification
Making any project's git repo's HEAD reference empty, should recreate the problem.
Edited by Vasilii Iakliushin