Fix dev-master not being normalized correctly for the root package, fixes #7007
parent
a5e35b9e89
commit
842a7ea922
|
@ -88,7 +88,7 @@ class VersionGuesser
|
||||||
|
|
||||||
private function postprocess(array $versionData)
|
private function postprocess(array $versionData)
|
||||||
{
|
{
|
||||||
if ('-dev' === substr($versionData['version'], -4)) {
|
if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
|
||||||
$versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
|
$versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +120,6 @@ class VersionGuesser
|
||||||
$version = $this->versionParser->normalizeBranch($match[1]);
|
$version = $this->versionParser->normalizeBranch($match[1]);
|
||||||
$prettyVersion = 'dev-' . $match[1];
|
$prettyVersion = 'dev-' . $match[1];
|
||||||
$isFeatureBranch = 0 === strpos($version, 'dev-');
|
$isFeatureBranch = 0 === strpos($version, 'dev-');
|
||||||
if ('9999999-dev' === $version) {
|
|
||||||
$version = $prettyVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($match[2]) {
|
if ($match[2]) {
|
||||||
|
|
|
@ -123,7 +123,8 @@ class VersionGuesserTest extends TestCase
|
||||||
$guesser = new VersionGuesser($config, $executor, new VersionParser());
|
$guesser = new VersionGuesser($config, $executor, new VersionParser());
|
||||||
$versionArray = $guesser->guessVersion(array(), 'dummy/path');
|
$versionArray = $guesser->guessVersion(array(), 'dummy/path');
|
||||||
|
|
||||||
$this->assertEquals("dev-master", $versionArray['version']);
|
$this->assertEquals("9999999-dev", $versionArray['version']);
|
||||||
|
$this->assertEquals("dev-master", $versionArray['pretty_version']);
|
||||||
$this->assertEquals($commitHash, $versionArray['commit']);
|
$this->assertEquals($commitHash, $versionArray['commit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue