"""The git-repo builder shared by the workspace-executor suites. Split out of ``tests/test_workspace_executor.py`` when that module was divided by theme; the helper is verbatim, so every sibling suite keeps the exact repository layout it was written against. """ from __future__ import annotations import subprocess from pathlib import Path def _init_repo(path: Path) -> None: path.mkdir(parents=True, exist_ok=True) subprocess.run(["git", "init"], cwd=path, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) subprocess.run(["git", "config", "user.email", "test@example.invalid"], cwd=path, check=True) subprocess.run(["git", "config", "user.name", "Test"], cwd=path, check=True) (path / "README.md").write_text("x\n", encoding="utf-8") subprocess.run(["git", "add", "README.md"], cwd=path, check=True) subprocess.run(["git", "commit", "-m", "init"], cwd=path, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)