mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 02:12:36 +02:00
14 lines
366 B
Python
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)
|