Headless repos now handled properly.

The test for headless now works, plus, we don't call get_branch()
twice for no reason. what what @waltaskew @turtlebender