1
0
Fork 0

Fix version guessing regression and a few other issues, fixes #7127

pull/7096/merge
Jordi Boggiano 2018-04-12 15:16:39 +02:00
parent 79d62cc51c
commit 9041622b86
3 changed files with 4 additions and 13 deletions

View File

@ -184,7 +184,7 @@ class VersionGuesser
$isFeatureBranch = 0 === strpos($version, 'dev-');
if ('9999999-dev' === $version) {
$version = 'dev-' . $branch;
return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
}
if (!$isFeatureBranch) {
@ -240,9 +240,6 @@ class VersionGuesser
$length = strlen($output);
$version = $this->versionParser->normalizeBranch($candidate);
$prettyVersion = 'dev-' . $match[1];
if ('9999999-dev' === $version) {
$version = $prettyVersion;
}
}
}
}
@ -260,10 +257,6 @@ class VersionGuesser
$branch = trim($output);
$version = $this->versionParser->normalizeBranch($branch);
$prettyVersion = 'dev-' . $branch;
if ('9999999-dev' === $version) {
$version = $prettyVersion;
}
}
// try to fetch current version from fossil tags
@ -295,9 +288,6 @@ class VersionGuesser
// we are in a branches path
$version = $this->versionParser->normalizeBranch($matches[3]);
$prettyVersion = 'dev-' . $matches[3];
if ('9999999-dev' === $version) {
$version = $prettyVersion;
}
return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
}

View File

@ -155,7 +155,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
if (!isset($package['version'])) {
$versionData = $this->versionGuesser->guessVersion($package, $path);
$package['version'] = $versionData['version'] ?: 'dev-master';
$package['version'] = $versionData['pretty_version'] ?: 'dev-master';
}
$output = '';

View File

@ -89,7 +89,8 @@ class VersionGuesserTest extends TestCase
$guesser = new VersionGuesser($config, $executor, new VersionParser());
$versionArray = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals('dev-' . $branch, $versionArray['version']);
$this->assertEquals("9999999-dev", $versionArray['version']);
$this->assertEquals("dev-".$branch, $versionArray['pretty_version']);
$this->assertEmpty($versionArray['commit']);
}