clonerefs: handle the case where we're on the target ref
clonerefs: handle the case where we're on the target ref

When we already have a cloned repository before we do a sync and we are
already on the target base ref before the sync, `git branch --force`
will fail. We therefore can check out the target SHA and reset the
branch while we're not on it, then checkout the branch again to not
remain in detached `HEAD` state after the sync.

Signed-off-by: Steve Kuznetsov <a7da0fca91d9933d2725d731a48cabdc9e8ffd7a@redhat.com>

lavalamp/test-infra,abgworrall/test-infra,kubernetes/test-infra,kargakis/test-infra,shyamjvs/test-infra,jlowdermilk/test-infra,jessfraz/test-infra,jlowdermilk/test-infra,cblecker/test-infra,BenTheElder/test-infra,michelle192837/test-infra,shyamjvs/test-infra,brahmaroutu/test-infra,pwittrock/test-infra,jlowdermilk/test-infra,brahmaroutu/test-infra,jessfraz/test-infra,shyamjvs/test-infra,kargakis/test-infra,abgworrall/test-infra,brahmaroutu/test-infra,pwittrock/test-infra,ixdy/kubernetes-test-infra,lavalamp/test-infra,monopole/test-infra,cblecker/test-infra,krzyzacy/test-infra,kubernetes/test-infra,cblecker/test-infra,cjwagner/test-infra,cblecker/test-infra,shyamjvs/test-infra,jlowdermilk/test-infra,krzyzacy/test-infra,monopole/test-infra,kubernetes/test-infra,dims/test-infra,monopole/test-infra,kargakis/test-infra,pwittrock/test-infra,kubernetes/test-infra,foxish/test-infra,brahmaroutu/test-infra,fejta/test-infra,foxish/test-infra,abgworrall/test-infra,fejta/test-infra,michelle192837/test-infra,cjwagner/test-infra,brahmaroutu/test-infra,shyamjvs/test-infra,BenTheElder/test-infra,BenTheElder/test-infra,fejta/test-infra,foxish/test-infra,lavalamp/test-infra,shyamjvs/test-infra,cjwagner/test-infra,monopole/test-infra,cjwagner/test-infra,ixdy/kubernetes-test-infra,lavalamp/test-infra,pwittrock/test-infra,foxish/test-infra,krzyzacy/test-infra,BenTheElder/test-infra,michelle192837/test-infra,kargakis/test-infra,monopole/test-infra,kargakis/test-infra,fejta/test-infra,jessfraz/test-infra,foxish/test-infra,dims/test-infra,cjwagner/test-infra,fejta/test-infra,mindprince/test-infra,dims/test-infra,mindprince/test-infra,mindprince/test-infra,jlowdermilk/test-infra,dims/test-infra,mindprince/test-infra,kubernetes/test-infra,pwittrock/test-infra,mindprince/test-infra,krzyzacy/test-infra,jlowdermilk/test-infra,michelle192837/test-infra,dims/test-infra,abgworrall/test-infra,michelle192837/test-infra,cjwagner/test-infra,krzyzacy/test-infra,monopole/test-infra,krzyzacy/test-infra,jessfraz/test-infra,jessfraz/test-infra,dims/test-infra,ixdy/kubernetes-test-infra,ixdy/kubernetes-test-infra,BenTheElder/test-infra,cblecker/test-infra,fejta/test-infra,BenTheElder/test-infra,kargakis/test-infra,jessfraz/test-infra,ixdy/kubernetes-test-infra,abgworrall/test-infra,lavalamp/test-infra,brahmaroutu/test-infra,lavalamp/test-infra,michelle192837/test-infra,cblecker/test-infra,kubernetes/test-infra