Never try to checkout an empty-named branch.

Fixes #2389.
Merge pull request #2390 from cogniva/fix-2389

Never try to checkout an empty-named branch.