From 49135101738a09cb9916f13537fd6072b614547c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 12 Aug 2019 16:50:14 +0800 Subject: [PATCH] qa/tasks/cbt.py: use "git --depth 1 for" faster clone we don't need the full history for performing the test. Signed-off-by: Kefu Chai --- qa/tasks/cbt.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qa/tasks/cbt.py b/qa/tasks/cbt.py index e3f35a5b35b..d3a0f0ddd73 100644 --- a/qa/tasks/cbt.py +++ b/qa/tasks/cbt.py @@ -179,13 +179,20 @@ class CBT(Task): branch = self.config.get('branch', 'master') branch = self.config.get('force-branch', branch) sha1 = self.config.get('sha1') - self.first_mon.run( - args=[ - 'git', 'clone', '-b', branch, repo, - '{tdir}/cbt'.format(tdir=testdir) - ] - ) - if sha1: + if sha1 is None: + self.first_mon.run( + args=[ + 'git', 'clone', '--depth', '1', '-b', branch, repo, + '{tdir}/cbt'.format(tdir=testdir) + ] + ) + else: + self.first_mon.run( + args=[ + 'git', 'clone', '-b', branch, repo, + '{tdir}/cbt'.format(tdir=testdir) + ] + ) self.first_mon.run( args=[ 'cd', os.path.join(testdir, 'cbt'), run.Raw('&&'), -- 2.39.5