1
0
Fork 0

Fix root aliasing and allow aliasing using the branch-alias as source

pull/1188/merge
Jordi Boggiano 2012-10-09 15:06:55 +02:00
parent c0cfe81eda
commit ded485dd60
1 changed files with 11 additions and 4 deletions

View File

@ -101,16 +101,23 @@ class Pool
} }
} }
foreach (array_keys($names) as $name) { foreach (array_keys($names) as $provided) {
$this->packageByName[$name][] =& $this->packages[$id-2]; $this->packageByName[$provided][] =& $this->packages[$id-2];
} }
// handle root package aliases // handle root package aliases
unset($rootAliasData);
if (isset($rootAliases[$name][$version])) { if (isset($rootAliases[$name][$version])) {
$rootAliasData = $rootAliases[$name][$version];
} elseif (isset($package['alias_normalized']) && isset($rootAliases[$name][$package['alias_normalized']])) {
$rootAliasData = $rootAliases[$name][$package['alias_normalized']];
}
if (isset($rootAliasData)) {
$alias = $package; $alias = $package;
unset($alias['raw']); unset($alias['raw']);
$alias['version'] = $rootAliases[$name][$version]['alias_normalized']; $alias['version'] = $rootAliasData['alias_normalized'];
$alias['alias'] = $rootAliases[$name][$version]['alias']; $alias['alias'] = $rootAliasData['alias'];
$alias['alias_of'] = $package['id']; $alias['alias_of'] = $package['id'];
$alias['id'] = $id++; $alias['id'] = $id++;
$alias['root_alias'] = true; $alias['root_alias'] = true;