checkout: do not corrupt HEAD on empty repo