refactor: return - if branch cannot be read

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-11-10 19:54:26 +01:00
parent 8aee23830a
commit a3fb57aee3

View File

@@ -104,10 +104,10 @@ def get_current_branch(repo: Path) -> str:
result: str = check_output(cmd, stderr=DEVNULL, cwd=repo).decode(
encoding="utf-8"
)
return result.strip()
return result.strip() if result else "-"
except CalledProcessError:
return ""
return "-"
def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]: