Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1532: Add git version requirements. #1550

Merged
merged 1 commit into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Robo/Commands/Deploy/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function deploy($options = [
'ignore-dirty' => FALSE,
'dry-run' => FALSE,
]) {
if (!$this->getInspector()->isGitMinimumVersionSatisfied('2.0')) {
$this->logger->error("Your system does not meet BLT's requirements. Please update git to 2.0 or newer.");
}
$this->checkDirty($options);

if (!$options['tag'] && !$options['branch']) {
Expand Down
18 changes: 18 additions & 0 deletions src/Robo/Inspector/Inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ public function commandExists($command) {
return $exit_code == 0;
}

/**
* Verifies that installed minimum git version is met.
*
* @param string $minimum_version
* The minimum git version that is required.
*
* @return bool
* TRUE if minimum version is satisfied.
*
*/
public function isGitMinimumVersionSatisfied($minimum_version) {
exec("git --version | cut -d' ' -f3", $output, $exit_code);
if (version_compare($output[0], $minimum_version, '>=')) {
return TRUE;
}
return FALSE;
}

/**
* Gets the local behat configuration defined in local.yml.
*
Expand Down