fix: checkout_new works on git 2.39
git before 2.43 reads a revision after --end-of-options in checkout as a pathspec, so every drafting run in node:22 failed with 'Cannot update paths and switch to branch'. Option-like values are refused instead and a trailing -- keeps rev a revision. The suite passes in node:22 (git 2.39.5, Python 3.11.2): 185 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cdfe3ed1ef
commit
7783b6e78f
2 files changed
+24
-2
No files matched your search
+10
-2
@@ -43,8 +43,16 @@ def run(args: list[str], cwd: Path, extra_env: Mapping[str, str] | None = None)
|
||||
|
||||
|
||||
def checkout_new(branch: str, rev: str, cwd: Path) -> None:
|
||||
"""Create or reset branch at rev and switch to it."""
|
||||
run(["checkout", "-q", "-B", branch, EOO, rev], cwd)
|
||||
"""Create or reset branch at rev and switch to it.
|
||||
|
||||
git before 2.43 reads a revision after --end-of-options in checkout as a pathspec
|
||||
("Cannot update paths and switch to branch"), and node:22 ships 2.39. So an
|
||||
option-like branch or rev is refused here instead, and the trailing -- keeps rev a
|
||||
revision."""
|
||||
for value in (branch, rev):
|
||||
if not value or value.startswith("-"):
|
||||
raise GitError(f"refusing to check out {value!r}")
|
||||
run(["checkout", "-q", "-B", branch, rev, "--"], cwd)
|
||||
|
||||
|
||||
def merge(rev: str, author: tuple[str, str], cwd: Path) -> None:
|
||||
|
||||
Reference in new issue
Block a user