Check if git working directory is clean. Raises: SystemExit: If there are uncommitted changes.
()
| 145 | |
| 146 | |
| 147 | def check_git_clean() -> None: |
| 148 | """Check if git working directory is clean. |
| 149 | |
| 150 | Raises: |
| 151 | SystemExit: If there are uncommitted changes. |
| 152 | """ |
| 153 | try: |
| 154 | status = run_command(["git", "status", "--porcelain"]) |
| 155 | if status: |
| 156 | console.print( |
| 157 | "[red]Error:[/red] You have uncommitted changes. Please commit or stash them first." |
| 158 | ) |
| 159 | sys.exit(1) |
| 160 | except subprocess.CalledProcessError as e: |
| 161 | console.print(f"[red]Error checking git status:[/red] {e}") |
| 162 | sys.exit(1) |
| 163 | |
| 164 | |
| 165 | def _branch_exists_local(branch: str, cwd: Path | None = None) -> bool: |
no test coverage detected