|
@@ -19,7 +19,6 @@ use Composer\Util\ProcessExecutor;
|
|
|
use Composer\IO\IOInterface;
|
|
|
use Composer\Util\Filesystem;
|
|
|
use Composer\Config;
|
|
|
-use Composer\Util\ProcessUtil;
|
|
|
|
|
|
/**
|
|
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
|
@@ -51,9 +50,9 @@ class GitDownloader extends VcsDownloader
|
|
|
$commandCallable = function ($url) use ($ref, $path, $command) {
|
|
|
return sprintf(
|
|
|
$command,
|
|
|
- ProcessUtil::escapeArgument($url),
|
|
|
- ProcessUtil::escapeArgument($path),
|
|
|
- ProcessUtil::escapeArgument($ref));
|
|
|
+ ProcessExecutor::escape($url),
|
|
|
+ ProcessExecutor::escape($path),
|
|
|
+ ProcessExecutor::escape($ref));
|
|
|
};
|
|
|
|
|
|
$this->gitUtil->runCommand($commandCallable, $url, $path, true);
|
|
@@ -83,7 +82,7 @@ class GitDownloader extends VcsDownloader
|
|
|
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
|
|
|
|
|
|
$commandCallable = function ($url) use ($command) {
|
|
|
- return sprintf($command, ProcessUtil::escapeArgument ($url));
|
|
|
+ return sprintf($command, ProcessExecutor::escape ($url));
|
|
|
};
|
|
|
|
|
|
$this->gitUtil->runCommand($commandCallable, $url, $path);
|
|
@@ -230,7 +229,7 @@ class GitDownloader extends VcsDownloader
|
|
|
&& $branches
|
|
|
&& preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
|
|
|
) {
|
|
|
- $command = sprintf('git checkout -B %s %s && git reset --hard %2$s', ProcessUtil::escapeArgument($branch), ProcessUtil::escapeArgument('composer/'.$reference));
|
|
|
+ $command = sprintf('git checkout -B %s %s && git reset --hard %2$s', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
|
|
|
if (0 === $this->process->execute($command, $output, $path)) {
|
|
|
return;
|
|
|
}
|
|
@@ -243,19 +242,19 @@ class GitDownloader extends VcsDownloader
|
|
|
$branch = 'v' . $branch;
|
|
|
}
|
|
|
|
|
|
- $command = sprintf('git checkout %s', ProcessUtil::escapeArgument($branch));
|
|
|
- $fallbackCommand = sprintf('git checkout -B %s %s', ProcessUtil::escapeArgument($branch), ProcessUtil::escapeArgument('composer/'.$branch));
|
|
|
+ $command = sprintf('git checkout %s', ProcessExecutor::escape($branch));
|
|
|
+ $fallbackCommand = sprintf('git checkout -B %s %s', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
|
|
|
if (0 === $this->process->execute($command, $output, $path)
|
|
|
|| 0 === $this->process->execute($fallbackCommand, $output, $path)
|
|
|
) {
|
|
|
- $command = sprintf('git reset --hard %s', ProcessUtil::escapeArgument($reference));
|
|
|
+ $command = sprintf('git reset --hard %s', ProcessExecutor::escape($reference));
|
|
|
if (0 === $this->process->execute($command, $output, $path)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $command = sprintf($template, ProcessUtil::escapeArgument($gitRef));
|
|
|
+ $command = sprintf($template, ProcessExecutor::escape($gitRef));
|
|
|
if (0 === $this->process->execute($command, $output, $path)) {
|
|
|
return;
|
|
|
}
|
|
@@ -274,7 +273,7 @@ class GitDownloader extends VcsDownloader
|
|
|
foreach ($this->process->splitLines($output) as $line) {
|
|
|
if (preg_match('{^composer/'.preg_quote($branch).'(?:\.x)?$}i', trim($line))) {
|
|
|
// find the previous commit by date in the given branch
|
|
|
- if (0 === $this->process->execute(sprintf($guessTemplate, $date, ProcessUtil::escapeArgument(trim($line))), $output, $path)) {
|
|
|
+ if (0 === $this->process->execute(sprintf($guessTemplate, $date, ProcessExecutor::escape(trim($line))), $output, $path)) {
|
|
|
$newReference = trim($output);
|
|
|
}
|
|
|
|
|
@@ -291,7 +290,7 @@ class GitDownloader extends VcsDownloader
|
|
|
}
|
|
|
|
|
|
// checkout the new recovered ref
|
|
|
- $command = sprintf($template, ProcessUtil::escapeArgument($newReference));
|
|
|
+ $command = sprintf($template, ProcessExecutor::escape($newReference));
|
|
|
if (0 === $this->process->execute($command, $output, $path)) {
|
|
|
$this->io->write(' '.$reference.' is gone (history was rewritten?), recovered by checking out '.$newReference);
|
|
|
|
|
@@ -311,7 +310,7 @@ class GitDownloader extends VcsDownloader
|
|
|
if ($protocols[0] !== 'git') {
|
|
|
$pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
|
|
|
}
|
|
|
- $cmd = sprintf('git remote set-url --push origin %s', ProcessUtil::escapeArgument($pushUrl));
|
|
|
+ $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
|
|
|
$this->process->execute($cmd, $ignoredOutput, $path);
|
|
|
}
|
|
|
}
|