projects
/
pharext
/
pharext
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
fix shebang
[pharext/pharext]
/
src
/
pharext
/
Task
/
GitClone.php
diff --git
a/src/pharext/Task/GitClone.php
b/src/pharext/Task/GitClone.php
index 709a34a3af32aa2ebe7215d031420ff3c093820d..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;
}
/**
}
/**
@@
-28,9
+34,16
@@
class GitClone implements Task
* @return \pharext\Tempdir
*/
public function run($verbose = false) {
* @return \pharext\Tempdir
*/
public function run($verbose = false) {
+ if ($verbose !== false) {
+ printf("Fetching %s ...\n", $this->source);
+ }
$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;
}
}