From 692787c6d884bf29c6dbaaa099f4ba57e20c42f4 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Sep 04 2016 20:37:31 +0000 Subject: fix behavior of view of tree if default branch is not 'master' --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 6d75e65..7eb9721 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -812,9 +812,9 @@ def view_tree(repo, identifier=None, username=None): branchname = identifier except (ValueError, TypeError): # If it's not a commit id then it's part of the filename - if 'master' in repo_obj.listall_branches(): + if not repo_obj.head_is_unborn: commit = repo_obj[repo_obj.head.target] - branchname = 'master' + branchname = repo_obj.head.shorthand # If we're arriving here from the release page, we may have a Tag # where we expected a commit, in this case, get the actual commit if isinstance(commit, pygit2.Tag):