checkout: split off a function to peel away branchname arg