mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 03:19:47 +03:00
helpers: make get_topdir return Path (MR 2413)
Since the return value is a file path, let's make it a Path object. Also update the docstring to reflect reality.
This commit is contained in:
parent
75a72725c9
commit
9e3d7af96b
1 changed files with 3 additions and 4 deletions
|
@ -331,18 +331,17 @@ def pull(repo_name: str) -> int:
|
|||
return 0
|
||||
|
||||
|
||||
def get_topdir(repo: Path) -> str:
|
||||
def get_topdir(repo: Path) -> Path:
|
||||
"""Get top-dir of git repo.
|
||||
|
||||
:returns: a string with the top dir of the git repository,
|
||||
or an empty string if it's not a git repository.
|
||||
:returns: the top dir of the git repository
|
||||
"""
|
||||
res = pmb.helpers.run.user(
|
||||
["git", "rev-parse", "--show-toplevel"], repo, output_return=True, check=False
|
||||
)
|
||||
if not isinstance(res, str):
|
||||
raise RuntimeError("Not a git repository: " + str(repo))
|
||||
return res.strip()
|
||||
return Path(res.strip())
|
||||
|
||||
|
||||
def get_files(repo: Path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue