1
0
Fork 0

Remove default branch alias from versions which are numeric, fixes #9705

pull/9706/head
Jordi Boggiano 2021-02-17 23:46:37 +01:00
parent 6035e462d8
commit d91fe67a80
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 36 additions and 1 deletions

View File

@ -375,7 +375,12 @@ class ArrayLoader implements LoaderInterface
}
}
if (isset($config['default-branch']) && $config['default-branch'] === true) {
if (
isset($config['default-branch'])
&& $config['default-branch'] === true
&& false === $this->versionParser->parseNumericAliasPrefix($config['version'])
) {
return VersionParser::DEFAULT_BRANCH_ALIAS;
}
}

View File

@ -0,0 +1,30 @@
--TEST--
Test that a conflict against >=5 does not include the default branch if it is a numeric branch.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "conflicter/pkg", "version": "1.0.0", "conflict": { "victim/pkg": ">=5", "victim/pkg2": ">=5" } },
{ "name": "victim/pkg", "version": "3.x-dev", "default-branch": true },
{ "name": "victim/pkg2", "version": "dev-foo" }
]
}
],
"require": {
"conflicter/pkg": "1.0.0",
"victim/pkg": "*",
"victim/pkg2": "*"
},
"minimum-stability": "dev"
}
--RUN--
update
--EXPECT--
Installing conflicter/pkg (1.0.0)
Installing victim/pkg (3.x-dev)
Installing victim/pkg2 (dev-foo)