1
0
Fork 0

Merge pull request #9706 from Seldaek/fix-default-branch-handling

Remove default branch alias from versions which are numeric
pull/9682/head
Jordi Boggiano 2021-02-18 09:12:21 +01:00 committed by GitHub
commit 2bceb1e0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)