1
0
Fork 0

GitDownloader: add option for single use git clone to avoid --dissociate when cloning from local copy (#10288)

pull/10290/head
Stephan 2021-11-17 18:53:10 +00:00 committed by GitHub
parent 0f5f0fb9e1
commit 63b5cbe000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -92,8 +92,15 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
if (!empty($this->cachedPackages[$package->getId()][$ref])) { if (!empty($this->cachedPackages[$package->getId()][$ref])) {
$msg = "Cloning ".$this->getShortHash($ref).' from cache'; $msg = "Cloning ".$this->getShortHash($ref).' from cache';
$cloneFlags = '--dissociate --reference %cachePath% ';
$transportOptions = $package->getTransportOptions();
if (isset($transportOptions['git']['single_use_clone']) && $transportOptions['git']['single_use_clone']) {
$cloneFlags = '';
}
$command = $command =
'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% ' 'git clone --no-checkout %cachePath% %path% ' . $cloneFlags
. '&& cd '.$flag.'%path% ' . '&& cd '.$flag.'%path% '
. '&& git remote set-url origin -- %sanitizedUrl% && git remote add composer -- %sanitizedUrl%'; . '&& git remote set-url origin -- %sanitizedUrl% && git remote add composer -- %sanitizedUrl%';
} else { } else {