diff --git a/moonraker/utils/source_info.py b/moonraker/utils/source_info.py index f10ed1b..925f419 100644 --- a/moonraker/utils/source_info.py +++ b/moonraker/utils/source_info.py @@ -23,9 +23,19 @@ def source_path() -> pathlib.Path: def is_git_repo(src_path: Optional[pathlib.Path] = None) -> bool: if src_path is None: - return source_path().joinpath(".git").is_dir() + src_path = source_path() return src_path.joinpath(".git").is_dir() +def within_git_repo(src_path: Optional[pathlib.Path] = None) -> bool: + if src_path is None: + src_path = source_path() + if src_path.joinpath(".git").is_dir(): + return True + for parent in src_path.parents: + if parent.joinpath(".git").is_dir(): + return True + return False + def is_dist_package(src_path: Optional[pathlib.Path] = None) -> bool: if src_path is None: # Check Moonraker's source path