Split checkout depending on target type (commit or reference).