checkupdates: get default branch from git config

This commit is contained in:
Hans-Christoph Steiner 2024-11-18 12:38:42 +01:00
parent fbe9152ee5
commit c97503b5f3
2 changed files with 2 additions and 4 deletions

View file

@ -690,9 +690,8 @@ def get_last_build_from_app(app: metadata.App) -> metadata.Build:
def get_git_repo_and_main_branch():
git_repo = git.Repo.init('.')
main_branch = 'main'
if main_branch not in git_repo.heads:
main_branch = 'master'
with git_repo.config_reader() as reader:
main_branch = reader.get_value('init', 'defaultBranch')
return git_repo, main_branch