Fix NoMethodError: undefined method `sha'
What does this MR do and why?
Contributes to #395480 (closed)
Problem
Empty repositories can have an default branch that doesn't point
anywhere. Attempt to access their sha
will raise a NoMethodError.
Solution
Verify that the default branch points to an existing commit before
requesting sha
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.