From 7b2fb19444b1c839d8073fe75b91b87320abdc7b Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 8 Feb 2012 19:06:13 +0100 Subject: [PATCH] lets try to get rid of the double clone --- lib/git_helper.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/git_helper.py b/lib/git_helper.py index ae03728..48fa7c9 100644 --- a/lib/git_helper.py +++ b/lib/git_helper.py @@ -72,18 +72,17 @@ def git_clone_remote_repository(url, destination): def git_new_branch_from(branch_name, from_branch): if git_repo_has_branch(branch_name): - cmd = [GIT, 'branch', '-D', branch_name] - - cmdobj = subprocess.Popen( - cmd, - shell=False, - close_fds=True, - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - env={'':''}, - cwd=os.getcwd() - ) - cmd = [GIT, 'checkout', branch_name] + cmd = [GIT, 'branch', '-D', branch_name] + + cmdobj = subprocess.Popen( + cmd, + shell=False, + close_fds=True, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + env={'':''}, + cwd=os.getcwd() + ) # this should not happen, we just deleted it if git_repo_has_branch(branch_name): @@ -134,6 +133,7 @@ def git_checkout_branch(branch_name): # and there is proper error handling below anyway... #if not git_repo_has_branch(branch_name): #raise BranchNotExistError(branch_name) + cmd = [GIT, 'checkout', branch_name] cmdobj = subprocess.Popen( -- 2.39.5