projects
/
pharext
/
pharext
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
support for git tags/branches
[pharext/pharext]
/
src
/
pharext
/
Task
/
GitClone.php
diff --git
a/src/pharext/Task/GitClone.php
b/src/pharext/Task/GitClone.php
index 7b84ca1efa29abe34a543267ec1d436907d1c184..55d759040416fb377aa63dba663f64273e3d0c55 100644
(file)
--- 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 $source;
+
+ /**
+ * @var string
+ */
+ private $branch;
/**
* @param string $source git repo location
*/
/**
* @param string $source git repo location
*/
- public function __construct($source) {
+ public function __construct($source
, $branch = null
) {
$this->source = $source;
$this->source = $source;
+ $this->branch = $branch;
}
/**
}
/**
@@
-33,7
+39,11
@@
class GitClone implements Task
}
$local = new Tempdir("gitclone");
$cmd = new ExecCmd("git", $verbose);
}
$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;
}
}
return $local;
}
}