search: Use canned headBranch only when repo.Branches[0] is HEAD
Created by: efritz
See https://github.com/sourcegraph/sourcegraph/pull/13373#discussion_r477452975.
Created by: efritz
See https://github.com/sourcegraph/sourcegraph/pull/13373#discussion_r477452975.