1
0
Fork 0

Fix dev-master not being normalized correctly for the root package, fixes #7007

pull/6896/head
Jordi Boggiano 2018-01-22 16:44:17 +01:00
parent a5e35b9e89
commit 842a7ea922
2 changed files with 3 additions and 5 deletions

View File

@ -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]) {

View File

@ -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']);
} }