Fix default-branch attribute on package files, and add it to schema
parent
6f0e5996de
commit
923f198a1f
|
@ -565,6 +565,10 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"default-branch": {
|
||||||
|
"type": ["boolean"],
|
||||||
|
"description": "Internal use only, do not specify this in composer.json. Indicates whether this version is the default branch of the linked VCS repository. Defaults to false."
|
||||||
|
},
|
||||||
"abandoned": {
|
"abandoned": {
|
||||||
"type": ["boolean", "string"],
|
"type": ["boolean", "string"],
|
||||||
"description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
|
"description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
|
||||||
|
|
|
@ -96,7 +96,7 @@ class ArrayDumper
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($package->isDefaultBranch()) {
|
if ($package->isDefaultBranch()) {
|
||||||
$data['default_branch'] = true;
|
$data['default-branch'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->dumpValues($package, $keys, $data);
|
$data = $this->dumpValues($package, $keys, $data);
|
||||||
|
|
|
@ -124,7 +124,7 @@ class ArrayLoader implements LoaderInterface
|
||||||
$package->setInstallationSource($config['installation-source']);
|
$package->setInstallationSource($config['installation-source']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config['default_branch']) && $config['default_branch'] === true) {
|
if (isset($config['default-branch']) && $config['default-branch'] === true) {
|
||||||
$package->setIsDefaultBranch(true);
|
$package->setIsDefaultBranch(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ class ArrayLoader implements LoaderInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config['default_branch']) && $config['default_branch'] === true) {
|
if (isset($config['default-branch']) && $config['default-branch'] === true) {
|
||||||
return VersionParser::DEV_MASTER_ALIAS;
|
return VersionParser::DEV_MASTER_ALIAS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,8 +231,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
||||||
$data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
|
$data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
|
||||||
$data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
|
$data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
|
||||||
|
|
||||||
// make sure tag do not contain the default_branch marker
|
// make sure tag do not contain the default-branch marker
|
||||||
unset($data['default_branch']);
|
unset($data['default-branch']);
|
||||||
|
|
||||||
// broken package, version doesn't match tag
|
// broken package, version doesn't match tag
|
||||||
if ($data['version_normalized'] !== $parsedTag) {
|
if ($data['version_normalized'] !== $parsedTag) {
|
||||||
|
@ -337,9 +337,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
||||||
$data['version'] = $version;
|
$data['version'] = $version;
|
||||||
$data['version_normalized'] = $parsedBranch;
|
$data['version_normalized'] = $parsedBranch;
|
||||||
|
|
||||||
unset($data['default_branch']);
|
unset($data['default-branch']);
|
||||||
if ($driver->getRootIdentifier() === $branch) {
|
if ($driver->getRootIdentifier() === $branch) {
|
||||||
$data['default_branch'] = true;
|
$data['default-branch'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isVeryVerbose) {
|
if ($isVeryVerbose) {
|
||||||
|
@ -446,9 +446,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
||||||
$this->io->overwriteError($msg, false);
|
$this->io->overwriteError($msg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($cachedPackage['default_branch']);
|
unset($cachedPackage['default-branch']);
|
||||||
if ($isDefaultBranch) {
|
if ($isDefaultBranch) {
|
||||||
$cachedPackage['default_branch'] = true;
|
$cachedPackage['default-branch'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
|
if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
|
||||||
|
|
Loading…
Reference in New Issue