~edwargix/git.sr.ht

f5db865a3ba074b1b7dd88236da930bf4e3c9279 — Bor Grošelj Simić 2 years ago 9448985
fix a 500 on refs/ in repos without a default branch
1 files changed, 5 insertions(+), 1 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +5 -1
@@ 556,8 556,12 @@ def refs(owner, repo):
                git_repo.get(git_repo.branches[branch].target)
            ) for branch in git_repo.raw_listall_branches(pygit2.GIT_BRANCH_LOCAL)]
        default_branch = git_repo.default_branch()
        if default_branch:
            _branch_key = lambda b: (b[1].raw_name == default_branch.raw_name, b[2].commit_time)
        else:
            _branch_key = lambda b: b[2].commit_time
        branches = sorted(branches,
                key=lambda b: (b[1].raw_name == default_branch.raw_name, b[2].commit_time),
                key=_branch_key,
                reverse=True)

        results_per_page = 10