Get the root directory of the git repository.
()
| 17 | |
| 18 | |
| 19 | def get_git_root() -> Path: |
| 20 | """Get the root directory of the git repository.""" |
| 21 | try: |
| 22 | return Path( |
| 23 | subprocess.check_output(["git", "rev-parse", "--show-toplevel"]) |
| 24 | .strip() |
| 25 | .decode("utf-8") |
| 26 | ) |
| 27 | except subprocess.CalledProcessError: |
| 28 | raise RuntimeError("Not a git repository or git is not installed.") |
no outgoing calls
searching dependent graphs…