if/else instead of try/except
@@ -91,9 +91,9 @@ class DistGit:
"""
Perform a `git checkout`
"""
- try:
+ if git_ref in self.local_project.git_repo.heads:
head = self.local_project.git_repo.heads[git_ref]
- except IndexError:
+ else:
head = self.local_project.git_repo.create_head(git_ref, commit=f"remotes/origin/{git_ref}")
head.checkout()
