From c368007500ed35be94c7cb461a68ba8c456e331f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 10 2016 15:13:44 +0000 Subject: Fix cloning repo which have a branch named 'origin' Without limiting the replace, the entire string was replaced and we ended up with a name being '' instead of 'origin'. --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index b3da502..a52a5d2 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1478,7 +1478,7 @@ def fork_project(session, user, repo, gitfolder, for branch in frepo.listall_branches(pygit2.GIT_BRANCH_REMOTE): branch_obj = frepo.lookup_branch(branch, pygit2.GIT_BRANCH_REMOTE) name = branch_obj.branch_name.replace( - branch_obj.remote_name, '')[1:] + branch_obj.remote_name, '', 1)[1:] if name in frepo.listall_branches(pygit2.GIT_BRANCH_LOCAL): continue frepo.create_branch(name, frepo.get(branch_obj.target.hex))