N98\Magento\Command\AbstractMagentoCommand::checkRepository PHP Method

checkRepository() protected method

brings locally cached repository up to date if it is missing the requested tag
protected checkRepository ( Composer\Package\PackageInterface $package, string $targetFolder )
$package Composer\Package\PackageInterface
$targetFolder string
    protected function checkRepository($package, $targetFolder)
    {
        if ($package->getSourceType() == 'git') {
            $command = sprintf('cd %s && git rev-parse refs/tags/%s', escapeshellarg($this->normalizePath($targetFolder)), escapeshellarg($package->getSourceReference()));
            $existingTags = shell_exec($command);
            if (!$existingTags) {
                $command = sprintf('cd %s && git fetch', escapeshellarg($this->normalizePath($targetFolder)));
                shell_exec($command);
            }
        } elseif ($package->getSourceType() == 'hg') {
            $command = sprintf('cd %s && hg log --template "{tags}" -r %s', escapeshellarg($targetFolder), escapeshellarg($package->getSourceReference()));
            $existingTag = shell_exec($command);
            if ($existingTag === $package->getSourceReference()) {
                $command = sprintf('cd %s && hg pull', escapeshellarg($targetFolder));
                shell_exec($command);
            }
        }
    }