X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpharext%2FTask%2FGitClone.php;h=55d759040416fb377aa63dba663f64273e3d0c55;hb=19af093853775f7cf8c423053806581be61f3cf4;hp=7b84ca1efa29abe34a543267ec1d436907d1c184;hpb=e458434f1a5539f1905e61835bed0123f1635067;p=pharext%2Fpharext diff --git a/src/pharext/Task/GitClone.php b/src/pharext/Task/GitClone.php index 7b84ca1..55d7590 100644 --- a/src/pharext/Task/GitClone.php +++ b/src/pharext/Task/GitClone.php @@ -15,12 +15,18 @@ class GitClone implements Task * @var string */ private $source; + + /** + * @var string + */ + private $branch; /** * @param string $source git repo location */ - public function __construct($source) { + public function __construct($source, $branch = null) { $this->source = $source; + $this->branch = $branch; } /** @@ -33,7 +39,11 @@ class GitClone implements Task } $local = new Tempdir("gitclone"); $cmd = new ExecCmd("git", $verbose); - $cmd->run(["clone", $this->source, $local]); + if (strlen($this->branch)) { + $cmd->run(["clone", "--depth", 1, "--branch", $this->branch, $this->source, $local]); + } else { + $cmd->run(["clone", $this->source, $local]); + } return $local; } }