Return `git status --porcelain` output, or None if the tree is clean. Raises: GitPorcelainError: if the underlying ``git status`` invocation fails. Per coding guidelines, we never silently fall back on missing critical resources; a broken Git invocation must surf
()
| 186 | |
| 187 | |
| 188 | def get_porcelain() -> str | None: |
| 189 | """Return `git status --porcelain` output, or None if the tree is clean. |
| 190 | |
| 191 | Raises: |
| 192 | GitPorcelainError: if the underlying ``git status`` invocation fails. |
| 193 | Per coding guidelines, we never silently fall back on missing |
| 194 | critical resources; a broken Git invocation must surface as a |
| 195 | hook failure rather than being collapsed into the clean-tree |
| 196 | "skip" path. |
| 197 | """ |
| 198 | result = run_cmd(["git", "status", "--porcelain"]) |
| 199 | if result.returncode != 0: |
| 200 | raise GitPorcelainError( |
| 201 | f"git status --porcelain failed (exit {result.returncode}): " |
| 202 | f"{(result.stderr or '').strip() or '(no stderr)'}" |
| 203 | ) |
| 204 | if not result.stdout.strip(): |
| 205 | return None |
| 206 | return result.stdout |
| 207 | |
| 208 | |
| 209 | def get_current_fingerprint(porcelain: str | None = None) -> str | None: |
no test coverage detected