Refactor clone/checkout part of vcs.clone().