Never try to checkout an empty-named branch.

Sorry but I haven't got the build prerequisites to verify that this change has the intended effect.  Hopefully the description of the bug in #2389 is adequate and this fix can easily be verified.