From ea0c711adfc46d4acb569aeaad37950576c885a5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 21 2015 17:14:18 +0000 Subject: Ensure the repo is not empty before rejecting a branch --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 2be28db..58f3994 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -778,13 +778,13 @@ def new_request_pull(repo, branch_to, branch_from, username=None): orig_repo = pygit2.Repository(parentpath) frombranch = repo_obj.lookup_branch(branch_from) - if not frombranch: + if not frombranch and not repo_obj.is_empty : flask.abort( 400, 'Branch %s does not exist' % branch_from) branch = orig_repo.lookup_branch(branch_to) - if not branch: + if not branch and not orig_repo.is_empty: flask.abort( 400, 'Branch %s could not be found in the target repo' % branch_to)