|
@@ -20,6 +20,7 @@ use Composer\Package\Loader\ValidatingArrayLoader;
|
|
use Composer\Package\Loader\InvalidPackageException;
|
|
use Composer\Package\Loader\InvalidPackageException;
|
|
use Composer\Package\Loader\LoaderInterface;
|
|
use Composer\Package\Loader\LoaderInterface;
|
|
use Composer\EventDispatcher\EventDispatcher;
|
|
use Composer\EventDispatcher\EventDispatcher;
|
|
|
|
+use Composer\Semver\Constraint\Constraint;
|
|
use Composer\IO\IOInterface;
|
|
use Composer\IO\IOInterface;
|
|
use Composer\Config;
|
|
use Composer\Config;
|
|
|
|
|
|
@@ -363,7 +364,12 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
|
private function validateBranch($branch)
|
|
private function validateBranch($branch)
|
|
{
|
|
{
|
|
try {
|
|
try {
|
|
- return $this->versionParser->normalizeBranch($branch);
|
|
|
|
|
|
+ $normalizedBranch = $this->versionParser->normalizeBranch($branch);
|
|
|
|
+
|
|
|
|
+ // validate that the branch name has no weird characters conflicting with constraints
|
|
|
|
+ $this->versionParser->parseConstraints($normalizedBranch);
|
|
|
|
+
|
|
|
|
+ return $normalizedBranch;
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
}
|
|
}
|
|
|
|
|
|
@@ -403,7 +409,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
|
|
$this->io->overwriteError($msg, false);
|
|
$this->io->overwriteError($msg, false);
|
|
}
|
|
}
|
|
|
|
|
|
- if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
|
|
|
|
|
|
+ if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
|
|
if ($isVeryVerbose) {
|
|
if ($isVeryVerbose) {
|
|
$this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
|
|
$this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
|
|
}
|
|
}
|