* Fix panic in API pulls when headbranch does not exist (#10676)
Backport #10676
* Fix panic in API pulls when headbranch does not exist
* refix other reference to plumbing.ErrReferenceNotFound
Signed-off-by: Andrew Thornton <[email protected]>
* Apply suggestions from code review
Co-Authored-By: Lauris BH <[email protected]>