Blob: config.py
Blob id: 41cb97cbb5a68b6fbae1c6d6433211a01f5d9c8f
Size: 837 B
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import pygit2 as git def get_repo_owner(repo_path: str) -> str | None: config = _load_repo_config(repo_path) if not config: return None try: return config["lipasto.owner"] except KeyError: return None except git.GitError: return None def is_repo_hidden(repo_path: str) -> bool: config = _load_repo_config(repo_path) if not config: return False try: raw_value = config["lipasto.hidden"] except KeyError: return False except git.GitError: return False return str(raw_value).strip().lower() == "true" def _load_repo_config(repo_path: str): try: repo = git.Repository(str(repo_path)) except git.GitError: return None try: return repo.config except git.GitError: return None |