diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php
index d6fb1bbee..9a9ba5833 100644
--- a/src/Composer/Repository/VcsRepository.php
+++ b/src/Composer/Repository/VcsRepository.php
@@ -43,6 +43,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
private $driver;
/** @var VersionCacheInterface */
private $versionCache;
+ private $emptyReferences = array();
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
{
@@ -117,6 +118,11 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
return $this->branchErrorOccurred;
}
+ public function getEmptyReferences()
+ {
+ return $this->emptyReferences;
+ }
+
protected function initialize()
{
parent::initialize();
@@ -159,6 +165,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($cachedPackage) {
$this->addPackage($cachedPackage);
+ continue;
+ } elseif ($cachedPackage === false) {
+ $this->emptyReferences[] = $identifier;
+
continue;
}
@@ -174,6 +184,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($verbose) {
$this->io->writeError('Skipped tag '.$tag.', no composer file');
}
+ $this->emptyReferences[] = $identifier;
continue;
}
@@ -212,6 +223,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
$this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
} catch (\Exception $e) {
+ if ($e instanceof TransportException) {
+ $this->emptyReferences[] = $identifier;
+ }
if ($verbose) {
$this->io->writeError('Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'');
}
@@ -258,6 +272,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($cachedPackage) {
$this->addPackage($cachedPackage);
+ continue;
+ } elseif ($cachedPackage === false) {
+ $this->emptyReferences[] = $identifier;
+
continue;
}
@@ -266,6 +284,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if ($verbose) {
$this->io->writeError('Skipped branch '.$branch.', no composer file');
}
+ $this->emptyReferences[] = $identifier;
continue;
}
@@ -284,6 +303,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
$this->addPackage($package);
} catch (TransportException $e) {
+ $this->emptyReferences[] = $identifier;
if ($verbose) {
$this->io->writeError('Skipped branch '.$branch.', no composer file was found');
}
@@ -352,6 +372,14 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
$cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
+ if ($cachedPackage === false) {
+ if ($verbose) {
+ $this->io->writeError('Skipped '.$version.', no composer file (cached from ref '.$identifier.')');
+ }
+
+ return false;
+ }
+
if ($cachedPackage) {
$msg = 'Found cached composer.json of ' . ($this->packageName ?: $this->url) . ' (' . $version . ')';
if ($verbose) {
diff --git a/src/Composer/Repository/VersionCacheInterface.php b/src/Composer/Repository/VersionCacheInterface.php
index db5934b59..41d485c64 100644
--- a/src/Composer/Repository/VersionCacheInterface.php
+++ b/src/Composer/Repository/VersionCacheInterface.php
@@ -17,7 +17,7 @@ interface VersionCacheInterface
/**
* @param string $version
* @param string $identifier
- * @return array Package version data
+ * @return array|null|false Package version data if found, false to indicate the identifier is known but has no package, null for an unknown identifier
*/
public function getVersionPackage($version, $identifier);
}