From 34f46f8b204d573dcf8c2991ab8dee37ced44926 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 04 2015 09:03:06 +0000 Subject: Forward the head to the commits page to fix the pull-request button Without head, the Pull-Request button does not know against which branch one wants to open the pull-request, which results in pointing to a non-existing page. --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index f97a893..bc7a063 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -260,6 +260,11 @@ def view_commits(repo, branchname=None, username=None): else: branch = None + if not repo_obj.is_empty and not repo_obj.head_is_unborn: + head = repo_obj.head.shorthand + else: + head = None + try: page = int(flask.request.args.get('page', 1)) except ValueError: @@ -328,6 +333,7 @@ def view_commits(repo, branchname=None, username=None): repo_obj=repo_obj, repo=repo, username=username, + head=head, branches=sorted(repo_obj.listall_branches()), branchname=branchname, last_commits=last_commits,