]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
lets try to get rid of the double clone
authorHolger Levsen <holger@layer-acht.org>
Wed, 8 Feb 2012 17:34:51 +0000 (18:34 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 8 Feb 2012 17:34:51 +0000 (18:34 +0100)
lib/git_helper.py

index f6020b548ebf5a3a40f344e88bef600345746806..228f63a3a9e5fd999f7f1d8aecb55c6772842ea1 100644 (file)
@@ -118,6 +118,17 @@ def git_checkout_branch(branch_name):
     #if not git_repo_has_branch(branch_name):
     #raise BranchNotExistError(branch_name)
 
+    cmd = [GIT, 'reset', '--hard']
+
+    cmdobj = subprocess.Popen(
+            cmd,
+            shell=False,
+            close_fds=True,
+            stderr=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            env={'':''},
+            cwd=os.getcwd()
+    )
     cmd = [GIT, 'checkout', branch_name]
 
     cmdobj = subprocess.Popen(