|
6 | 6 | import subprocess |
7 | 7 | import sys |
8 | 8 | import tempfile |
9 | | -from functools import cached_property, partial |
| 9 | +from functools import cached_property |
10 | 10 | from pathlib import Path |
11 | 11 | from types import TracebackType |
12 | 12 | from typing import Any, Optional |
@@ -50,18 +50,11 @@ def clone_path(self) -> Path: |
50 | 50 | ["git", "clone", self.repo, "repo"], cwd=self.tempdir, check=True |
51 | 51 | ) |
52 | 52 | clone_path = self.tempdir / "repo" |
53 | | - run = partial(subprocess.run, cwd=clone_path, check=True) |
54 | | - if ( |
55 | | - run( |
56 | | - ["git", "ls-remote", "origin", self.branch], |
57 | | - capture_output=True, |
58 | | - ) |
59 | | - .stdout.decode() # type: ignore |
60 | | - .strip() |
| 53 | + for cmd in ( |
| 54 | + ["git", "checkout", "-b", self.branch], |
| 55 | + ["git", "reset", "--hard", "origin/main"], |
61 | 56 | ): |
62 | | - raise Exception(f'Branch "{self.branch}" already exists on remote') |
63 | | - run(["git", "checkout", "-b", self.branch]) |
64 | | - run(["git", "reset", "--hard", "origin/main"]) |
| 57 | + subprocess.run(cmd, cwd=clone_path, check=True) |
65 | 58 | return clone_path |
66 | 59 |
|
67 | 60 | def cruft_attr(self, attr: str) -> str: |
|
0 commit comments