Merge "Fix checkout when preparing a ref"