Initialize a git repo in the workspace (idempotent).
(self)
| 20 | self.root = Path(workspace_root).resolve() |
| 21 | |
| 22 | def init(self) -> None: |
| 23 | """Initialize a git repo in the workspace (idempotent).""" |
| 24 | if not (self.root / ".git").exists(): |
| 25 | logger.info("Initializing git repo at %s", self.root) |
| 26 | self._git("init") |
| 27 | self._git("config", "user.email", "evolver@agent-evolve") |
| 28 | self._git("config", "user.name", "Agent Evolve") |
| 29 | |
| 30 | self._git("add", "-A") |
| 31 | try: |
| 32 | self._git("commit", "-m", "Initial workspace state") |
| 33 | self._git("tag", "evo-0") |
| 34 | logger.info("Created initial commit with tag evo-0") |
| 35 | except RuntimeError: |
| 36 | pass # already committed |
| 37 | |
| 38 | def commit(self, message: str, tag: str | None = None) -> None: |
| 39 | self._git("add", "-A") |