From d1f456850c6297ca3fbb3ec0daddfddafdeff784 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 16 Mar 2016 09:05:46 +0100 Subject: [PATCH] workunit: git checkout sha1/branch/tag git clone --branch refspec only accepts branches and tags but not a sha1 git reset --hard refspec only accepts tags and sha1 but not branches Use git checkout because it interprets branches, tags and sha1 as expected. $ git checkout jewel Branch jewel set up to track remote branch jewel from origin. Switched to a new branch 'jewel' $ git checkout v0.94.6 HEAD is now at e832001... 0.94.6 $ git checkout b2503b0e15c0b13f480f0835060479717b9cf935 HEAD is now at 95cefea... 0.94.3 Signed-off-by: Loic Dachary --- tasks/workunit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/workunit.py b/tasks/workunit.py index 2b1d4130b5e..86bcdb5b9f6 100644 --- a/tasks/workunit.py +++ b/tasks/workunit.py @@ -314,13 +314,13 @@ def _run_tests(ctx, refspec, role, tests, env, subdir=None, timeout=None): args=[ 'git', 'clone', - '--branch', - refspec, git_url, clonedir, run.Raw(';'), 'cd', '--', clonedir, run.Raw('&&'), + 'git', 'checkout', refspec, + run.Raw('&&'), 'mv', 'qa/workunits', srcdir, ], )