Use regex to capture git version.
parent
b5c55d5167
commit
75b88a13fe
|
@ -282,9 +282,9 @@ class Git
|
||||||
if (0 !== $this->process->execute('git --version', $output)) {
|
if (0 !== $this->process->execute('git --version', $output)) {
|
||||||
throw new \RuntimeException(self::sanitizeUrl('Failed retrieve git version, git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
|
throw new \RuntimeException(self::sanitizeUrl('Failed retrieve git version, git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
|
||||||
}
|
}
|
||||||
if (strpos($output, 'git version ') === FALSE) {
|
if (preg_match('/^git version (.*)/', $output, $matches) !== 1) {
|
||||||
throw new \RuntimeException('git --version output seems to have changed, expected "git version x.y.z".');
|
throw new \RuntimeException('git --version output seems to have changed, expected "git version x.y.z".');
|
||||||
}
|
}
|
||||||
return substr($output, 12);
|
return $matches[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue