dangerzone/dev_scripts/dev_utils.py
2024-10-09 20:03:44 +03:00

14 lines
366 B
Python

import pathlib
import subprocess
def git_root():
"""Get the root directory of the Git repo."""
# FIXME: Use a Git Python binding for this.
# FIXME: Make this work if called outside the repo.
path = (
subprocess.check_output(["git", "rev-parse", "--show-toplevel"])
.decode()
.strip("\n")
)
return pathlib.Path(path)