Remove `Repository#root_ref_sha` method
<!--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=395653)
</details>
<!--IssueSummary end-->
### Problem
Bug in https://gitlab.com/gitlab-org/gitlab/-/issues/395480+ exposes the problem with `Repository#root_ref_sha` method
It doesn't verify that the head commit exist and it leads to `NoMethodError`.
This method is used across the application.
### Proposal
Remove the method completely and replace usages with the code that correctly handles this case.
```
head_commit = repository.head_commit
if head_commit
sha = head_commit.sha
...
```
Or alternatively, use `head_commit&.sha` version. However, we should still verify that it doesn't break existing code.
issue