From b066368a50ed8ce3b1274c1bd1e5990f1cf6667b Mon Sep 17 00:00:00 2001 From: boston Date: Mon, 15 Sep 2014 16:07:21 +0600 Subject: [PATCH] SCM: Git clone performance Via: - http://stackoverflow.com/questions/1778088/how-to-clone-a-single-branch-in-git - http://stackoverflow.com/questions/6941889/is-git-clone-depth-1-shallow-clone-more-useful-than-it-makes-out - http://git-scm.com/docs/git-clone --- Mage/Task/BuiltIn/Scm/CloneTask.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Mage/Task/BuiltIn/Scm/CloneTask.php b/Mage/Task/BuiltIn/Scm/CloneTask.php index 7c50b4a..c5c1170 100644 --- a/Mage/Task/BuiltIn/Scm/CloneTask.php +++ b/Mage/Task/BuiltIn/Scm/CloneTask.php @@ -64,16 +64,12 @@ class CloneTask extends AbstractTask $this->runCommandLocal('mkdir -p ' . $this->source['temporal']); switch ($this->source['type']) { case 'git': - // Clone Repo + // Fast clone Repo form Branch $command = 'cd ' . $this->source['temporal'] . ' ; ' - . 'git clone ' . $this->source['repository'] . ' . '; + . 'git clone --depth 1 -q -b ' . $this->source['from'] + . ' ' . $this->source['repository'] . ' . '; $result = $this->runCommandLocal($command); - // Checkout Branch - $command = 'cd ' . $this->source['temporal'] . ' ; ' - . 'git checkout ' . $this->source['from']; - $result = $result && $this->runCommandLocal($command); - $this->getConfig()->setFrom($this->source['temporal']); break; @@ -84,4 +80,4 @@ class CloneTask extends AbstractTask return $result; } -} \ No newline at end of file +}