Return the short hash of HEAD, or None when there is no commit yet.
(self)
| 135 | return False |
| 136 | |
| 137 | def head_commit(self) -> str | None: |
| 138 | """Return the short hash of HEAD, or None when there is no commit yet.""" |
| 139 | result = subprocess.run( |
| 140 | ["git", "rev-parse", "--short", "--verify", "HEAD"], # noqa: S607 |
| 141 | cwd=self.path, |
| 142 | capture_output=True, |
| 143 | text=True, |
| 144 | ) |
| 145 | return result.stdout.strip() if result.returncode == 0 else None |
| 146 | |
| 147 | def has_changes_under_path(self) -> bool | None: |
| 148 | """Return whether files under ``path`` differ from HEAD, or None if unknown. |