public function doDownload(PackageInterface $package, $path, $url)
    {
        GitUtil::cleanEnv();
        $path = $this->normalizePath($path);

        if (!$this->isRequiredRepository($path, $url)) {
            throw new FilesystemException('Unknown repository installed into ' . $path);
        }

        $ref = $package->getSourceReference();
        if ($this->io->isVerbose()) {
            $this->io->write('    Multi-repository path: ' . $path);
        }
        if (!$this->isRepositoryCloned($path)) {
            $this->io->write('    Multi-repository GIT directory not found. Cloning...');
            $this->cloneRepository($package, $path, $url);
        } else {
            $this->io->write('    Multi-repository GIT directory found. Fetching changes...');
            $this->fetchRepositoryUpdates($package, $path, $url);
        }

        if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
            if ($package->getDistReference() === $package->getSourceReference()) {
                $package->setDistReference($newRef);
            }
            $package->setSourceReference($newRef);
        }

        //copy file into required directory
        $this->copyFilesToDefaultPath($path);
    }