3 namespace pharext\Task
;
12 class GitClone
implements Task
25 * @param string $source git repo location
27 public function __construct($source, $branch = null) {
28 $this->source
= $source;
29 $this->branch
= $branch;
33 * @param bool $verbose
34 * @return \pharext\Tempdir
36 public function run($verbose = false) {
37 if ($verbose !== false) {
38 printf("Fetching %s ...\n", $this->source
);
40 $local = new Tempdir("gitclone");
41 $cmd = new ExecCmd("git", $verbose);
42 if (strlen($this->branch
)) {
43 $cmd->run(["clone", "--depth", 1, "--branch", $this->branch
, $this->source
, $local]);
45 $cmd->run(["clone", $this->source
, $local]);