mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
checkupdates: get default branch from git config
This commit is contained in:
parent
fbe9152ee5
commit
c97503b5f3
2 changed files with 2 additions and 4 deletions
|
@ -690,9 +690,8 @@ def get_last_build_from_app(app: metadata.App) -> metadata.Build:
|
||||||
|
|
||||||
def get_git_repo_and_main_branch():
|
def get_git_repo_and_main_branch():
|
||||||
git_repo = git.Repo.init('.')
|
git_repo = git.Repo.init('.')
|
||||||
main_branch = 'main'
|
with git_repo.config_reader() as reader:
|
||||||
if main_branch not in git_repo.heads:
|
main_branch = reader.get_value('init', 'defaultBranch')
|
||||||
main_branch = 'master'
|
|
||||||
return git_repo, main_branch
|
return git_repo, main_branch
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -461,7 +461,6 @@ class CheckupdatesTest(unittest.TestCase):
|
||||||
git_repo.index.commit("all files")
|
git_repo.index.commit("all files")
|
||||||
|
|
||||||
repo, branch = fdroidserver.checkupdates.get_git_repo_and_main_branch()
|
repo, branch = fdroidserver.checkupdates.get_git_repo_and_main_branch()
|
||||||
self.assertTrue(branch in ('main', 'master'))
|
|
||||||
self.assertTrue(branch in repo.heads)
|
self.assertTrue(branch in repo.heads)
|
||||||
|
|
||||||
def test_checkout_appid_branch_does_not_exist(self):
|
def test_checkout_appid_branch_does_not_exist(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue