git p4: rearrange and simplify hasOrigin handling