aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-04-26 06:43:38 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-04-26 06:43:38 +0200
commitd9d9656d3e346d17607b328e37b5bf4daad7bed5 (patch)
tree03d4f911aec211bd571592052924449663a16a26 /src
parentd9245ba06190207bfa24fd3602d4f9ee3987d043 (diff)
downloadphorkie-d9d9656d3e346d17607b328e37b5bf4daad7bed5.tar.gz
phorkie-d9d9656d3e346d17607b328e37b5bf4daad7bed5.zip
check git version in setupcheck
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/SetupCheck.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/phorkie/SetupCheck.php b/src/phorkie/SetupCheck.php
index 959ff42..2c0dd80 100644
--- a/src/phorkie/SetupCheck.php
+++ b/src/phorkie/SetupCheck.php
@@ -26,6 +26,7 @@ class SetupCheck
$sc = new self();
$sc->checkDeps();
$sc->checkDirs();
+ $sc->checkGit();
}
public function checkDeps()
@@ -49,6 +50,22 @@ class SetupCheck
}
}
+ public function checkGit()
+ {
+ $line = exec('git --version', $lines, $retval);
+ if ($retval !== 0) {
+ $this->fail('Running git executable failed.');
+ }
+ if (!preg_match('#^git version ([0-9.]+)$#', $line, $matches)) {
+ $this->fail('git version output format unexpected: ' . $line);
+ }
+ if (version_compare($matches[1], '1.7.5') < 0) {
+ $this->fail(
+ 'git version needs to be at least 1.7.5, got: ' . $matches[1]
+ );
+ }
+ }
+
public function fail($msg)
{
throw new Exception($msg);